A+B Problem III
A+B Problem III
時間限製:1000 ms | 內存限製:65535 KB
難度:1
- 描述
- 求A+B是否與C相等。
- 輸入
- T組測試數據。
每組數據中有三個實數A,B,C(-10000.0<=A,B<=10000.0,-20000.0<=C<=20000.0)
數據保證小數點後不超過4位。
- 輸出
- 如果相等則輸出Yes
不相等則輸出No - 樣例輸入
-
3 -11.1 +11.1 0 11 -11.25 -0.25 1 2 +4
- 樣例輸出
-
Yes Yes No
查看代碼---運行號:252390----結果:Accepted
運行時間:2012-10-05 19:13:36 | 運行人:huangyibiao
01.
#include <cstdio>
02.
#include <iostream>
03.
#include <cmath>
04.
using
namespace
std;
05.
06.
int
main()
07.
{
08.
int
t;
09.
scanf
(
"%d "
, &t);
10.
while
(t--)
11.
{
12.
double
a, b, c;
13.
cin >> a >> b >> c;
14.
if
(
fabs
(a+b
- c) <=0.0000001)
15.
printf
(
"Yes\n"
);
16.
else
17.
printf
(
"No\n"
);
18.
}
19.
return
0;
20.
}
最後更新:2017-04-02 15:14:54