본문 바로가기

백준/C++

[Baekjoon/C++] 31654번 - Adding Trouble

[백준] 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;
}