[백준] Baekjoon Online Judge
문제
Your friend Bob is really bad at adding numbers, and he’d like some help to make sure he’s doing it correctly! Can you help Bob make sure he is adding correctly? Given 3 integers 𝐴, 𝐵, 𝐶, make sure that 𝐴+𝐵=𝐶, and that Bob indeed added 𝐴 and 𝐵 correctly.
입력
The input consists of a single line with 3 integers 𝐴,𝐵,𝐶 where −10^9 ≤ 𝐴,𝐵,𝐶 ≤ 10^9
출력
Output either correct! if 𝐴+𝐵=𝐶, or wrong! if 𝐴+𝐵≠𝐶.
풀이
#include <iostream>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int A, B, C;
cin >> A >> B >> C;
if (A + B == C) cout << "correct!\n";
else cout << "wrong!\n";
return 0;
}
'백준 > C++' 카테고리의 다른 글
[Baekjoon/C++] 1967번 - 트리의 지름 (0) | 2024.06.25 |
---|---|
[Baekjoon/C++] 14938번 - 서강그라운드 (0) | 2024.06.24 |
[Baekjoon/C++] 30804번 - 과일 탕후루 (1) | 2024.06.07 |
[Baekjoon/C++] 30802번 - 웰컴 키트 (1) | 2024.06.05 |
[Baekjoon/C++] 28702번 - FizzBuzz (0) | 2024.06.04 |