首页 > 代码库 > HDoj- 2054 A==B?

HDoj- 2054 A==B?

<marquee width="600">【科普】什么是BestCoder?如何参加?
</marquee>

A == B ?

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


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<cstdio>
#include<cstring>
#define maxn 10000000
char s1[maxn];
char s2[maxn];
char *str(char *s)
{
	int len=strlen(s);
	if(strchr(s,'.')!=NULL)
	{ 
		while(s[--len]=='0');
            if(s[len]=='.')
                len--;
            s[len+1]='\0';
	} 
	return s;
}
int main()
{
	while(scanf("%s%s",s1,s2)!=EOF)
	{
		if(!strcmp(str(s1),str(s2)))
			printf("YES\n");
		else
			printf("NO\n");
	}
	return 0;
}



HDoj- 2054 A==B?