📦 Changgo/🏫 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;
}
/*
*/
반응형