Notice
Recent Posts
Recent Comments
Link
«   2025/10   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
Archives
Today
Total
관리 메뉴

코딩로그

[백준/BOJ/C++] 13985번 Equality 본문

YJ/C++

[백준/BOJ/C++] 13985번 Equality

Team DAON 2021. 11. 2. 17:20

[문제]

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";
}

[결과 화면]