2016 Pacific Northwest Region Programming Contest—Division 2 Problem R — limit 1 second Equality
来源:互联网 发布:周扬青 淘宝 编辑:程序博客网 时间:2024/06/05 16:48
Problem R — limit 1 second 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.
Input
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.
Output
Print, on a single line, YES if the sum is correct; otherwise, print NO.
Sample Input Sample Output
1 + 2 = 3 YES
Sample Input Sample Output
2 + 2 = 5 NO
2016 Pacific Northwest Region Programming Contest—Division 2
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.
Input
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.
Output
Print, on a single line, YES if the sum is correct; otherwise, print NO.
Sample Input Sample Output
1 + 2 = 3 YES
Sample Input Sample Output
2 + 2 = 5 NO
2016 Pacific Northwest Region Programming Contest—Division 2
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
using namespace std;
#include<stdlib.h>
#include<iostream>
using namespace std;
int main()
{
char s[10];
gets(s);
int a = atoi(&s[0]);
int b = atoi(&s[4]);
int c = atoi(&s[8]);
if(a + b == c)
printf("YES\n");
else
printf("NO\n");
//printf("%c %c %c",s[0],s[4],s[8]);
return 0;
}
{
char s[10];
gets(s);
int a = atoi(&s[0]);
int b = atoi(&s[4]);
int c = atoi(&s[8]);
if(a + b == c)
printf("YES\n");
else
printf("NO\n");
//printf("%c %c %c",s[0],s[4],s[8]);
return 0;
}
阅读全文
0 0
- 2016 Pacific Northwest Region Programming Contest—Division 2 Problem R — limit 1 second Equality
- 2016 Pacific Northwest Region Programming Contest—Division 2 Problem S — limit 1 second Gravity
- 2016 Pacific Northwest Region Programming Contest—Division 2 Problem M
- 2015 Pacific Northwest Region Programming Contest—Division 2 Problem P — Complexity(字符串、贪心)
- Sichuan State Programming Contest 2011 —— D.Division
- 2015-2016 ACM-ICPC Pacific Northwest Regional Contest Div.2( Problem V Gears)
- 2016-2017 ACM-ICPC Pacific Northwest Regional Contest (Div. 2)
- 【2015-2016 ACM-ICPC Pacific Northwest Regional Contest (Div 1)C】【排序 模拟】Classy 课程难度排序超多关键字
- Programming Contest Problem Types
- Programming Contest Problem Types
- 2015-2016 ACM-ICPC Pacific Northwest Regional Contest Div.2 全部题目题解
- 2016-2017 ACM-ICPC Pacific Northwest Regional Contest (Div. 2)【solved:12 / 13】
- 2016-2017 ACM-ICPC Pacific Northwest Regional Contest (Div. 1) 【solved:9 / 12】
- C语言学习日记—— C Programming language second edition
- Gym 101243 (2016-2017 ACM Central Region of Russia Quarterfinal Programming Contest)
- 2016-2017 ACM-ICPC Pacific Northwest Regional Contest
- 6th Jilin Province Collegiate Programming Contest - Mar 20, 2012——Problem A: Welcome 2012
- 6th Jilin Province Collegiate Programming Contest ——Problem B: Chinese Knight
- MapReduce简介
- vector容器中iterator的使用
- 高斯消元
- [10] Linux系统日常运维
- 多行数据输出与处理
- 2016 Pacific Northwest Region Programming Contest—Division 2 Problem R — limit 1 second Equality
- Intel P6以来核心架构及对应型号、芯片组一览表
- Fragment replace的使用
- 【UOJ261 BZOJ 】天天爱跑步(线段树合并)
- leetcode -- 345. Reverse Vowels of a String 【双指针 + 逆序的变形】
- Mybatis:ReflectionException: There is no getter for property named 'productName' in 'class java.lang
- 搜索 棋盘问题
- 内存的几个小问题
- codeforces 821d Okabe and City