코딩로그
[백준/BOJ/C++] 13985번 Equality 본문
[문제]
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.
[Source Code]
#include <stdio.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;
int main() {
int a, b, c;
char op, temp;
cin >> a >> op >> b >> temp >> c;
if(a + b == c)
cout << "YES";
else
cout << "NO";
}
[결과 화면]
'YJ > C++' 카테고리의 다른 글
[백준/BOJ/C++] 5751번 Head or Tail (0) | 2021.11.02 |
---|---|
[백준/BOJ/C++] 9699번 RICE SACK (0) | 2021.11.02 |
[백준/BOJ/C++] 16018번 Occupy parking (0) | 2021.11.02 |
[백준/BOJ/C++] 14782번 Bedtime Reading, I (0) | 2021.11.02 |
[백준/BOJ/C++] 11506번 占쏙옙 (0) | 2021.11.02 |