본문 바로가기
반응형

C++162

[백준/BOJ] 2010번 - 플러그 (C++) 문제 링크 코드 #include using namespace std; int main(void) { ios::sync_with_stdio(0); cin.tie(0); int n, a, s = 0; cin >> n; for (int i = 0; i > a; s += a; } cout 2022. 3. 22.
[백준/BOJ] 1934번 - 최소공배수 (C++) 문제 링크 코드 #include using namespace std; int gcd(int a, int b) { if (a > t; while (t--) { cin >> a >> b; cout 2022. 3. 22.
[백준/BOJ] 1920번 - 수 찾기 (C++) 문제 링크 코드 #include #include using namespace std; int main(void) { ios::sync_with_stdio(0); cin.tie(0); unordered_set s; int n, m, t; cin >> n; while (n--) { cin >> t; s.insert(t); } cin >> m; while (m--) { cin >> t; if (s.find(t) != s.end()) cout 2022. 3. 22.
[백준/BOJ] 1764번 - 듣보잡 (C++) 문제 링크 코드 #include #include using namespace std; int main(void) { ios::sync_with_stdio(0); cin.tie(0); unordered_set s; vector ans; string str; int n, m, i; cin >> n >> m; for (i = 0; i > str; s.insert(str); } for (i = 0; i > str; if (s.find(str) != s.end()) ans.push_back(str); } sort(ans.begin(), ans.end()); cout 2022. 3. 22.
[백준/BOJ] 1755번 - 숫자 놀이 (C++) 문제 링크 코드 #include using namespace std; int main(void) { ios::sync_with_stdio(0); cin.tie(0); vector str = { "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine" }; vector v; string s; int M, N, i; cin >> M >> N; for (i = M; i = 10) s = str[i/10] + ' ' + str[i%10]; else s = str[i]; v.push_back(make_pair(s, i)); } sort(v.begin(), v.end()); for (i = 0; i < v.size(); i++) {.. 2022. 3. 22.
[백준/BOJ] 1712번 - 손익분기점 (C++) 문제 링크 코드 #include using namespace std; int main(void) { ios::sync_with_stdio(0); cin.tie(0); long a, b, c; cin >> a >> b >> c; if (b >= c) { cout 2022. 3. 21.
[백준/BOJ] 1541번 - 잃어버린 괄호 (C++) 문제 링크 코드 #include using namespace std; int main(void) { ios::sync_with_stdio(0); cin.tie(0); string s; cin >> s; int result = 0, n = 0; char op = '+'; for (auto c : s) { if (c >= '0' && c 2022. 3. 21.
[백준/BOJ] 1475번 - 방 번호 (C++) 문제 링크 코드 #include using namespace std; int arr[9]; int main(void) { ios::sync_with_stdio(0); cin.tie(0); int n; cin >> n; while (n) { if (n%10 == 9) arr[6]++; else arr[n%10]++; n /= 10; } arr[6] = (arr[6] + 1) / 2; int max = 0; for (int i = 0; i max) max = arr[i]; cout 2022. 3. 21.
[백준/BOJ] 1436번 - 영화감독 숌 (C++) 문제 링크 코드 #include using namespace std; int main(void) { ios::sync_with_stdio(0); cin.tie(0); int n, cnt = 1, ans = 666; cin >> n; while (cnt != n) { ans++; string s = to_string(ans); if (s.find("666") != string::npos) cnt++; } cout 2022. 3. 21.
[백준/BOJ] 1431번 - 시리얼 번호 (C++) 문제 링크 코드 #include using namespace std; bool comp(string a, string b) { if (a.length() != b.length()) return a.length() = '0' && c = '0' && c > n; vector v(n); for (i = 0; i > v[i]; sort(v.begin(), v.end(), comp); for (i = 0; i < n; i++) cout 2022. 3. 21.
반응형