๐Ÿ“ฆ Chango/๐Ÿซ First Solve at School

[BOJ B4][C++] ๋ฐฑ์ค€ 13985๋ฒˆ: Equality

์„ ๋‹ฌ 2022. 12. 30. 13:56
๋ฐ˜์‘ํ˜•

https://www.acmicpc.net/problem/13985

 

13985๋ฒˆ: Equality

Print, on a single line, YES if the sum is correct; otherwise, print NO.

www.acmicpc.net

 

๋ฌธ์ œ

You are grading an arithmetic quiz. The quiz asks a student for the sum of the numbers. Determine if the student taking the quiz got the question correct.

์ž…๋ ฅ

The first and the only line of input contains a string of the form:

a + b = c

It is guaranteed that a, b, and c are single-digit positive integers. The input line will have exactly 9 characters, formatted exactly as shown, with a single space separating each number and arithmetic operator.

์ถœ๋ ฅ

Print, on a single line, YES if the sum is correct; otherwise, print NO.

 

ํ’€์ด

// Authored by : seondal
// Co-authored by : -

// #include <bits/stdc++.h>
#include <iostream>
#include <vector>

using namespace std;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    
    int a, b, c;
    char oper, eq;
    cin >> a >> oper >> b >> eq >> c;
    
    if(a+b == c)
        cout << "YES";
    else
        cout << "NO";
    
    return 0;
}

/*
 */
๋ฐ˜์‘ํ˜•