现在的位置: 首页 > 综合 > 正文

hdu 2054

2012年09月18日 ⁄ 综合 ⁄ 共 822字 ⁄ 字号 评论关闭

A == B ?

Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 29789    Accepted Submission(s): 4579

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
 

Author
8600 && xhd
 

Source
 

Recommend
#include <stdio.h>
#include
<string.h>
#include
<stdlib.h>

char str1[100000], str2[100000];

void deal(char *str)
{
int i, j, len;

char *p = str;
while( *p == '0')
p
++;
strcpy(str, p);
if(strchr(str, '.')) {
len
= strlen(str);
p
= len + str - 1;
while( *p == '0')
*(p--) = 0;
if (*p == '.')
*p = 0;

}
}



int main( )
{

while(scanf("%s%s", str1,str2)!= EOF) {
deal(str1);
deal(str2);
if (strcmp(str1, str2) == 0)
puts(
"YES");
else
puts(
"NO");
}
return 0;
}

  

抱歉!评论已关闭.