A + B Problem Too【HDU - 2101】
阿新 • • 發佈:2018-12-07
A + B Problem Too問題
水題,不多說先上題目
題目
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.
Time limit | Memory limit | OS | Source |
---|---|---|---|
1000 ms | 32768 kB | Windows | HDU 2007-6 Programming Contest |
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.
Example
input | output |
---|---|
1 1 | no |
8600 8600 | yes |
問題連結:HDU - 2101
問題描述
輸入兩個資料,求它們的和,並判斷和能不能被86整除,如果能就輸出yes,不能則輸出no。
問題分析
首先獲得使用者的兩個輸入,然後求兩數的和,將和存於一變數中,然後再用該變數除以86求餘數,如果餘數得0則輸出yes,其他數則輸出no。在其外套上一層while迴圈用於重複程式。
AC通過的C++語言程式程式碼如下:
#include<iostream>
using namespace std;
int main()
{
int a, b, r;
while (cin >> a >> b)
{
r = a + b;
if (r % 86 == 0)
cout << "yes" << endl;
else
cout << "no" << endl;
}
}