本文主要是介绍HDU A - A == B ? HDU - 2054,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
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
经验教训:数组太小或太大都会WA或TLE或RE
代码:(所有的双等号都要删去其中空格)
#include <stdio.h>
#include <string.h>
char *change(char *a)
{
int len = strlen(a);
if(strchr(a,’.’) != NULL)
{
while(a[–len]= =‘0’);
if(a[len]==’.’)
len–;
a[len+1]=’\0’;
}
return a;
}
int main()
{
char a[50000], b[50000];
while(~scanf("%s %s", a, b))
{
if(!strcmp(change(a),change(b)))
printf(“YES\n”);
else
printf(“NO\n”);
}
return 0;
}
这篇关于HDU A - A == B ? HDU - 2054的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!