백준 c++ 1475번 방 번호 1475 방 번호 문제 풀이 #include #include using namespace std; int num[10]; string n; int main(void) { cin >> n; for (int i = 0; i < n.length(); i++) { if (n[i] == '9') { num[6]++; } else num[n[i] - 48]++; } num[6] = num[9] = (num[6] + 1) / 2; cout 자라는 개발자/문제풀이 2022.01.10
백준 c++ 1021 회전하는 큐 1021 회전하는 큐 문제 풀이 #include #include using namespace std; int main() { deque dq; int m, n, cnt = 0; cin >> n >> m; for (int i = 1; i > num; for (int i = 0; i < n; i++) { if (dq[i] == num) { idx = i; break; } } if (idx < dq.size() / 2 + 1) { for (int i = 0; i < dq.size(); i++) { if (dq.front() == num) { dq.pop_front(); break; } dq.push_back(dq.front()); dq.pop_front(); cnt++; } } else { for (int i.. 자라는 개발자/문제풀이 2022.01.09
백준 c++ 23841번 데칼코마니 23841번 데칼코마니 문제풀이 #include #include using namespace std; void fast_io(void) { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); } int main(void) { fast_io(); int n, m; cin >> n >> m; while (n--) { char grim[51]; cin >> grim; for (int i = 0; i < m; i++) { if (isalpha(grim[i])) { grim[m - i - 1] = grim[i]; } } cout 자라는 개발자/문제풀이 2022.01.06
백준 C++ 10809 알파벳 찾기 10809 알파벳 찾기 문제풀이 #include using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); char str[101]; cin >> str; int alpha[26]; fill_n(alpha, 26, -1); int len = strlen(str); for (int i = 0; i < len; i++) { if (alpha[str[i] - 97] == -1) alpha[str[i] - 97] = i; } for (int a : alpha) { cout 자라는 개발자/문제풀이 2022.01.05
백준 C++ 17219번 비밀번호 찾기 17219 번 비밀번호 찾기 문제풀이 #include #include #include #include using namespace std; void fast_io(void) { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); } string c, d; int main(void) { fast_io(); map m; int a, b; cin >> a >> b; cin.ignore(); while (a--) { string all; getline(cin, all); stringstream ss(all); ss >> c >> d; m.insert(make_pair(c, d)); } while (b--) { cin >> c; cout second 자라는 개발자/문제풀이 2022.01.04
백준 c++ 1620 나는야 포켓몬 마스터 이다솜 1620번 나는야 포켓몬 마스터 이다솜 문제 문제 풀이 #include #include #include using namespace std; void fast_io(void) { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); } int main(void) { fast_io(); map mpInt; map mpStr; int n, m, idx = 0; cin >> n >> m; while (n--) { idx++; string str; cin >> str; mpInt.insert(make_pair(idx, str)); mpStr.insert(make_pair(str, idx)); } while (m--) { char arr[21]; ci.. 자라는 개발자/문제풀이 2022.01.02
백준 C++/C 2577번 숫자의 개수 2577번 숫자의 개수 문제 풀이 #include #include using namespace std; void fast_io(void) { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); } int main(void) { fast_io(); int a, b, c, i = 0; int num[10] = { 0, }; cin >> a >> b >> c; string str = to_string(a * b * c); for (char c : str) { num[c - '0']++; } for (int n : num) { cout 자라는 개발자/문제풀이 2021.12.27
백준 C++ 1764번 듣보잡 1764번 듣보잡 문제풀이 #include #include #include #include using namespace std; void fast_io(void) { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); } int main(void) { fast_io(); vector ear; vector res; int n, m; cin >> n >> m; for (int i = 0; i > str; ear.push_back(str); } sort(ear.begin(), ear.end()); for (int i = 0; i > str; i.. 자라는 개발자/문제풀이 2021.12.26
백준 C/C++ 11050번 이항 계수 1 11050번 이항 계수 1 문제풀이 #include #include using namespace std; int get_value(int a) { int res = 1; if (a 1) { res = a * get_value(a - 1); } return res; } int main(void) { int n, k; scanf("%d %d", &n, &k); printf("%d", get_value(n) / (get_value(k) * get_value(n - k))); } 팩토리얼을 재귀로 구현해보았다. 자라는 개발자/문제풀이 2021.12.23
백준 C++ 11651번 좌표정렬하기 2 백준 11651번 좌표 정렬하기 2 문제풀이 #include #include #include #include using namespace std; int main(void) { vector v; int n, a, b; cin >> n; for (int i = 0; i > a >> b; v.push_back(pair(b, a)); } sort(v.begin(), v.end()); for (int i = 0; i < n; i++) { printf("%d %d\n", v[i].second, v[i].first); } } 입력받은 값을 바꿔서 넣어줬다. 자라는 개발자/문제풀이 2021.12.22