A == B ?
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 87320 Accepted Submission(s): 13770
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
注意:此题应注意类似下列测试数据;
1.00 1.00000000
#include<stdio.h>
#include<string.h>
void change(char s[])
{
int len_s;
len_s=strlen(s);
if(strchr(s,'.'))//字符查找函数,返回第一次出现查找字符的位置
{
for(int i=len_s-1;s[i]=='0';i--)
{
s[i]='\0';
len_s--;
}
}
if(s[len_s-1]=='.')
s[len_s-1]='\0';
}
int main()
{
char s1[100000],s2[100000];
while(scanf("%s%s",s1,s2)!=EOF)
{
change(s1);
change(s2);
if(strcmp(s1,s2))
/*
字符串比较函数,
如果s1<s2,返回一个小于零的值 ;
如果两个字符相等,返回零;
如果s1>s2,返回一个大于零的值
*/
printf("NO\n");
else printf("YES\n");
}
return 0;
}