/images/logo.png

[백준]10996 별 찍기 - 21

https://www.acmicpc.net/problem/10996 풀이: 지그제그로 n번 별을 찍는다. 코드: 사용언어 : c++ 1 2 3 4 5 6 7 8 9 10 11 #include <iostream>using namespace std; int n, i, t; int main() { cin >> n; for (i = 0; i < n * 2; i++) { for (t = 0; t < n / 2 + (i % 2 ? 0 : n % 2); t++) printf("%s", i % 2 ?

[백준]1453 피시방 알바

https://www.acmicpc.net/problem/1453 풀이: 거절당하는 사람의 수를 출력한다. 코드: 사용언어 : c++ 1 2 3 4 5 6 7 8 9 10 11 #include <iostream>using namespace std; int n, m, s = 0, a[101]; int main() { cin >> n; while (n--) { cin >> m; a[m]?s++:a[m]++; } cout << s << endl; }

[백준]14681 사분면 고르기

https://www.acmicpc.net/problem/14681 풀이: 점 (x, y)의 사분면 번호를 출력한다. 코드: 사용언어 : c++ 1 2 3 4 5 6 7 8 9 10 #include <iostream>using namespace std; int x, y; int main() { cin >> x >> y; if (x > 0 && y > 0) cout << "1" << endl; if (x < 0 && y > 0) cout << "2" << endl; if (x < 0 && y < 0) cout << "3" << endl; if (x > 0 && y < 0) cout << "4" << endl; }

[백준]17176 암호해독기

https://www.acmicpc.net/problem/17176 풀이: 암호의 쓰인 알파벳들을 저장한다. 평문을 살펴보며 암호에 쓰였는지 확인한다. 암호의 없는 알파벳이 나온다면, n을 아니라면 y를 출력한다. 코드: 사용언어 : c++ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 #include <iostream>using namespace std; int n, m, b, i, s, a[53]; int main() { cin >> n; for (i = 0; i <= n; i++) { cin >> m; a[m]++; } for (i = 0; i < n; i++) { s = getchar(); s -= s > 96 ?