hdu 2054A == B ?

来源:互联网 发布:fc2免费破解版域名 编辑:程序博客网 时间:2024/06/01 09:29

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

只要把小数点后的零干掉就行了如12.000 12 5.10 5.10000000

#include<iostream>#include<cstring>using namespace std;char a[100000],b[100000];bool is   (char *p){for(; *p != '\0' ; p++)if(*p == '.')return true;return false;}void det  (char *p){for(; *p != '\0' ; p++);p--;for(; *p == '0' ; p--)*p = '\0';if(*p == '.')*p = '\0';}int main(){while(cin>>a>>b){if(is(a))det(a);if(is(b))det(b);if(strcmp(a,b) == 0)cout<<"YES";else cout<<"NO";cout<<endl;}return 0;} 


0 0
原创粉丝点击