A == B ?
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 65188 Accepted Submission(s): 10191
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
#include<stdio.h>
#include<string.h>
int havepoint(char str[])
{
int i,len;
len=strlen(str);
for(i=0;i<len;i++)
{
if(str[i]=='.')
return 1;
}
return 0;
}
void change(char str[])
{
int i,len;
len=strlen(str);
if(havepoint(str))
{
for(i=len-1;str[i]=='0';i--)
{
str[i]='\0';
len--;
}
if(str[len-1]=='.')
str[len-1]='\0';
}
}
int main()
{
char str1[1000000],str2[1000000];
while(scanf("%s %s",str1,str2)!=EOF)
{
change(str1);
change(str2);
if(strcmp(str1,str2)==0)
printf("YES\n");
else printf("NO\n");
}
return 0;
}
这道题居然不考虑前缀0!!!