Notice
Recent Posts
목록백준기초 (12)
천천히 빛나는
백준 단계 3 : 반복문 (C++)
10950. 두 정수 A와 B를 입력받은 다음, A+B를 출력하는 프로그램을 작성하시오. #include using namespace std; int main() { int n; cin >> n; for (int i = 1; i > n; int item, price, total = 0; for (int i = 0; i > item >> price; total += item * price; } if (x == total){ cout b; cout b) { ... } 위와 같은 방식도 가능하다. cin이 조건문 안에 있는 경우에 연산자 오버로딩에 의해 bool..
C++/BAEKJOON (C++)
2023. 8. 16. 14:09
백준 단계 2 : 조건문 (C++)
1330. 두 정수 A와 B가 주어졌을 때, A와 B를 비교하는 프로그램을 작성하시오. #include using namespace std; int main() { int a, b; cin >> a >> b; if (a > b) { cout = 90) { cout = 80) { cout = 70) { cout = 60) { cout year; if ((year % 4 == 0) && ((year % 100 != 0) || (year % 400 == 0))) { cout x >> y; if ((x > 0) && (y > 0)) { cout c; a += c / 60; b += c % 60; if (b >= 60) { b -= 60; a += 1; } if (a >= 24) { a -= 24; } cout ..
C++/BAEKJOON (C++)
2023. 8. 14. 16:13