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
-
#include<iostream> #include<cmath> using namespace std; int main() { int n; double a,b,c; cin>>n; while(n--) { cin>>a>>b>>c; if(fabs(a+b-c)<=0.00000001) cout<<"Yes"<<endl; else cout<<"No"<<endl; } return 0; }