A+B Problem III
来源:互联网 发布:ubuntu root密码 编辑:程序博客网 时间:2024/06/08 06:32
- 描述
- 求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 011 -11.25 -0.251 2 +4
- 样例输出
YesYesNo
解题报告: 当处理实数的时候要注意精度!
code:
#include<iostream>#include<algorithm>#include<stdio.h>#include<queue>#include<math.h>#include<string.h>#include <stdlib.h>using namespace std;int main(){ freopen("input.txt","r",stdin); int t; double a,b,c; cin>>t; while(t--){ cin>>a>>b>>c; if(fabs(a+b-c)<=0.0001) cout<<"Yes"<<endl; else cout<<"No"<<endl; } return 0;}
0 0
- A+B Problem III
- A+B Problem III
- A+B Problem III
- A+B Problem III
- A+B Problem III
- A+B Problem III
- A+B Problem III
- A+B Problem III
- A+B Problem III
- A+B Problem III
- A+B Problem III
- A+B Problem III
- A+B Problem III
- A+B Problem III
- 477 A+B Problem III
- ACM-A+B Problem III
- 477 A+B Problem III
- 55.A+B Problem III
- 最小生成树-Prim算法和Kruskal算法
- Linux学习系列之Mount
- 欢迎使用CSDN-markdown编辑器
- 侠客无双
- 求非空格字符串的长度,并打印字符串
- A+B Problem III
- pwn专用虚拟机的简单工具配置
- activity从底部弹出动画
- makefile的语法及写法
- Git使用心得(二)
- 一步一步的实现Android的mvp框架
- 这里是标题
- Coreseek多表索引搜索(转载)
- 初学者的福利7