본문 바로가기

Coding/BaekJoon

B_2346 #include #include #include using namespace std; deque dq; void init() { ios_base::sync_with_stdio(false); std::cin.tie(0); std::cout.tie(0); } int main(void) { init(); int N, num; vector answer; cin >> N; for (int i = 0; i > num; dq.push_back(make_pair(num, i + 1)); } while (!dq.empty()) { int this_bloon = dq.front().first; answer.push_back(dq.front().second); dq.pop_front(); if.. 더보기
B_24511 한참 고민했던 문제 해결하다보니 결정론적으로 문제를 풀어버린 것 같아서 조금 아쉬운 문제 #include #include #include using namespace std; void init() { ios_base::sync_with_stdio(false); std::cin.tie(0); std::cout.tie(0); } int main(void) { init(); int N, M, num; deque dq; bool is_qs[100001] = {0, }; cin >> N; for(int i = 0; i > is_qs[i]; for(int i = 0; i > num; if(is_qs[i] == 0) dq.push_back(num); } cin.. 더보기
B_13909 #include #include using namespace std; int main(void) { long N; vector windows; cin >> N; for (long i = 0; i 더보기
B_4134 #include #include using namespace std; bool isPrime(long long n) { long long count = sqrt(n); for (long long i = 2; i > n; for (long long i = 0; i > tmp; if (tmp == 1 || tmp == 0) { cout 더보기
B_1929 #include #include #define number 1000000 #define MAX 1000001 using namespace std; int prime_num[MAX]; int main(void) { for (int i = 2; i > N; for (int i = M; i 더보기
B_4948 #include #include #define number 246912 #define MAX 246913 using namespace std; int prime_num[MAX] = { 0, }; void init() { prime_num[1] = 0; for (int i = 2; i n) { int count = 0; if (n == 0) break; for (int i = (n + 1); i 더보기
B_10816 Sol.1, unordered_map #include #include using namespace std; int main(void) { int N, M, card; unordered_map m; ios::sync_with_stdio(false); cin.tie(0); cin >> N; for (int i = 0; i > card; m[card]++; } cin >> M; for (int i = 0; i > card; cout N; for (int i = 0; i > card; arr[i] = card; } sort(arr, arr + N); cin >> M; for (int i = 0; i < M; i++) { .. 더보기
B_1934 #include using namespace std; int gcd(int a, int b) { int r = a % b; if (r == 0) return b; return gcd(b, r); } int main(void) { int T, A, B, temp, answer; cin >> T; for (int i = 0; i > A >> B; if (A >= B) temp = gcd(A, B); else temp = gcd(B, A); answer = A * B / temp; cout 더보기