A == B ?(考虑小数)
来源:互联网 发布:java 圆周率算法 编辑:程序博客网 时间:2024/05/16 02:10
A == B ?
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 67197 Accepted Submission(s): 10467
Problem Description
Give you two numbers A and B, if A is equal to B, you should print "YES", or print "NO".
Input
each test case contains two numbers A and B.
Output
for each case, if A is equal to B, you should print "YES", or print "NO".
Sample Input
1 22 23 34 3
Sample Output
NOYESYESNO
Author
8600 && xhd
Source
校庆杯Warm Up
#include<iostream>#include<cstring>using namespace std;void qq(char *a){ int len,i; len=strlen(a)-1; for(i=len;i>=0;i--) { if(a[i]=='0') len--; //去掉小数点后的0 else break; } if(a[len]=='.') //如果小数点后全是0,那小数点也得去掉 len--; a[len+1]='\0'; //通过加结束标志来去掉}int main(){ int i,len; char a[50000],b[50000]; while(cin>>a>>b) { len=strlen(a); for(i=0;i<len;i++) { if(a[i]=='.') //对有小数点的数据处理 qq(a); } len=strlen(b); for(i=0;i<len;i++) { if(b[i]=='.') qq(b); } if(strcmp(a,b)) cout<<"NO"<<endl; else cout<<"YES"<<endl; } return 0;}
超时严重
0 0
- A == B ?(考虑小数)
- 小数A+B(大数)
- YT14-HDU-A+B(高精度小数)
- 小数A+B
- hdu 1877居然第一次wr是因为没有考虑a=b=0
- 大明A+B-第一次周赛(有小数)
- HDU1753—大明A+B(大正小数相加)
- HDU1753 大明A+B(带小数的大数加法)
- NYOJ A+B IV 小数相加(大数问题)
- A^B = B^A
- A^B = B^A
- A^B = B^A
- A^B=B^A
- nyoj 803 A/B Problem(大数除小数&&大数求余小数)
- 之江学院 K: qwb与小数(思维求A/B第n位小数)
- Python a,b=b,a+b
- a,b=b,a+b 与 a=b,b=a+b
- 小数精度 1753 大明A+B
- PHP接口继承及接口多继承详解
- [Android UI布局]android:gravit与android:layout_gravity的区别
- WEB 打印 LODOP
- 人工神经网络(Artificial Neural Networks)
- Java读取ini配置
- A == B ?(考虑小数)
- 机器学习的各种资源链接
- Android Layout中dip, dp, px, sp区别
- POJ1006
- hdu 4008 树形dp 时间戳在树形结构中的应用
- 几种漂亮的hr横线!!!
- ubuntu更新软件时候磁盘空间不足的问题
- 【BZOJ】【P2594】【Wc2006】【水管局长数据加强版】【题解】【LCT】
- JAVA URL相关类介绍