HDU_2054——A=B问题

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 2 2 2 3 3 4 3
 

 

Sample Output
NO YES YES NO
 1 #include <cstdio>
 2 #include <cstring>
 3 char* fun(char *str)
 4 {
 5     if(strchr(str,'.')!=NULL)
 6         {
 7             int i=strlen(str);
 8             while(str[--i]=='0');
 9             if(str[i]=='.')
10                 i--;
11             str[i+1]='\0';
12         }
13     return str;
14 }
15 //不用考虑前导0的情况 
16 int main()
17 {
18     char a[100000],b[100000];
19     while(~scanf("%s%s",a,b))
20         {
21             if(strcmp(fun(a),fun(b))==0)
22                 printf("YES\n");
23             else
24                 printf("NO\n");
25         }
26     return 0;    
27 }

 

posted @ 2013-07-11 22:25  瓶哥  Views(279)  Comments(0Edit  收藏  举报