본문 바로가기

백준52

[1181번] 단어 정렬 1181번: 단어 정렬 www.acmicpc.net /*1181번 단어 정렬*/ #include #include #include #include using namespace std; int N; string in; vectorv; vectorout; pairtemp; int main() { ios::sync_with_stdio(0), cin.tie(0); cin >> N; for (int i = 0; i > in; v.push_back(in); } sort(v.begin(), v.end());//입력 받은것을 정렬해서 v.erase(unique(v.begin(), v.end()),v.end());//중복 제거 //단어의 길이와 단어를 저장하는 벡터에 넣어줌 for (int .. 2019. 3. 13.
[1026번] 보물 1026번: 보물 www.acmicpc.net /*1026번 보물*/ #include #include using namespace std; int A[50], B[50]; int N, result; bool desc(int a, int b) { return a > b; } int main() { ios::sync_with_stdio(0), cin.tie(0); cin >> N; for (int i = 0; i > A[i]; } for (int i = 0; i > B[i]; } sort(A, A + N); sort(B, B + N, desc); for (int i = 0; i < N; i++) { result += A[i] * B[i]; } cout 2019. 3. 12.
[10828번] 스택 10828번: 스택 www.acmicpc.net /*10828번 스택*/ #include #include using namespace std; int N, top_pointer; string command; int stack_arr[10000]; void push(int n) { stack_arr[++top_pointer] = n; } void pop() { if (top_pointer >= 0) { int return_value = stack_arr[top_pointer]; stack_arr[top_pointer--] = 0; cout 2019. 3. 12.
[10815번] 숫자카드 10815번: 숫자 카드 www.acmicpc.net /*10815번 숫자카드*/ #include #include using namespace std; int N, M, target; int Card[500000]; int main() { ios::sync_with_stdio(0), cin.tie(0); cin >> N; for (int i = 0; i > Card[i]; sort(Card, Card + N); cin >> M; for (int i = 0; i > target; if (binary_search(Card, Card + N, target) == 0) cout 2019. 3. 11.