一期作业第8题

题目:
This problem is also a A + B problem,but it has a little difference,you should determine does (a+b) could be divided with 86.For example ,if (A+B)=98,you should output no for result.
Input
Each line will contain two integers A and B. Process to end of file.
Output
For each case, if(A+B)%86=0,output yes in one line,else output no in one line.
Sample Input
1 1
8600 8600
Sample Output
no
yes
翻译版:
这个问题也是一个A+B问题,但是它有一点不同,你应该确定是否(a+b)可以除以86。例如,如果(A+B)=98,你应该为结果输出no。

输入

每一行将包含两个整数A和B进程到文件结束。

产量

对于每一种情况,如果(A+B)% 86=0,则在一行中输出“是”,否则在一行中输出NO。

样本输入

1 1

8600 8600

样本输出

#include<iostream>
#include<stdlib.h>
using namespace std;
int main()
{
	int a, b;
	while (cin >> a >> b)
	{
		cin >> a >> b;
		if ((a + b) % 86 == 0)
		{
			cout << "yes" << endl;
		}
		else
		{
			cout << "no" << endl;
		}
	}
	return 0;
}```
解释:
用了if函数得到不同的结果

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章