码迷,mamicode.com
首页 > 其他好文 > 详细

HDoj- 2054 A==B?

时间:2014-11-15 15:38:03      阅读:201      评论:0      收藏:0      [点我收藏+]

标签:cstring   c++   iostream   

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?

标签:cstring   c++   iostream   

原文地址:http://blog.csdn.net/holyang_1013197377/article/details/41145757

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!