본문 바로가기

전체 글

(52)
[백준] 8958번 OX퀴즈 c++ #include using namespace std; int main(void) { ios::sync_with_stdio(NULL); cin.tie(NULL); cout.tie(NULL); int num; int sum = 0; int count = 0; string test; cin >> num; for (int i = 0; i > test; for (int j = 0; j < test.length(); j++) { if (test[j] == 'O') { count++; sum += count; } else { count = 0; } } cout
[백준] 10996번 별 찍기 -21 c++ #include using namespace std; int main(void) { ios::sync_with_stdio(NULL); cin.tie(NULL); cout.tie(NULL); int num; cin >> num; if (num == 1) { cout
[백준] 1110번 더하기 사이클 c++ #include using namespace std; int main(void) { ios::sync_with_stdio(NULL); cin.tie(NULL); cout.tie(NULL); int cycle = 0; int num; int newNum = 0; int num2; cin >> num; num2 = num; while (1) { newNum = 10 * (num2 % 10) + (num2 / 10 + num2 % 10) % 10; if (num == newNum) { cycle++; break; } num2 = newNum; cycle++; } cout
[백준] 5543번 상근날드 c++ #include using namespace std; int main(void) { ios::sync_with_stdio(NULL); cin.tie(NULL); cout.tie(NULL); int arr[3] = { 0, }; int arr2[2] = { 0, }; int hamburger, coke; for (int i = 0; i > hamburger; arr[i] = hamburger; } else{ cin >> coke; arr2[i-3] = coke; } } sort(arr, arr + 3); sort(arr2, arr2 + 2); cout
[백준] 2884번 알람 시계 c++ #include using namespace std; int main(void) { ios::sync_with_stdio(NULL); cin.tie(NULL); cout.tie(NULL); int h, m; cin >> h >> m; if (h != 0 && m >= 45) { cout
[백준] 2675번 문자열 반복 c++ #include using namespace std; int main(void) { ios::sync_with_stdio(NULL); cin.tie(NULL); cout.tie(NULL); int num,number; string str; cin >> num; for (int i = 0; i > number >> str; for (int j = 0; j < str.length(); j++) { for (int k = 0; k < number; k++) { cout
[백준] 10809번 알파벳 찾기 c++ #include using namespace std; int main(void) { ios::sync_with_stdio(NULL); cin.tie(NULL); cout.tie(NULL); int arr[26] = {0,}; for (int i = 0; i > str; for (int j = 0; j < str.length(); j++) { if(arr[str[j] - 'a'] == -1) arr[str[j] - 'a'] = j; } for (int n : arr) { cout
[백준] 2523 별찍기-13 c++ #include using namespace std; int main(void) { ios::sync_with_stdio(NULL); cin.tie(NULL); cout.tie(NULL); int num; cin >> num; for (int i = 0; i < num; i++) { for (int j = 0; j < i+1; j++) { cout