HDU 2054 A == B A但是看不太明白,
来源:学生作业帮 编辑:搜狗做题网作业帮 分类:综合作业 时间:2024/06/14 03:48:27
HDU 2054 A == B A但是看不太明白,
Time Limit:1000/1000 MS (Java/Others) Memory Limit:32768/32768 K (Java/Others)
Total Submission(s):38421 Accepted Submission(s):5912
#include
#include
#include
char str1[100000],str2[100000];
void deal(char *str)
{
int i,j,len;
char *p = str;
while( *p == '0')
p++;
strcpy(str,p);
if(strchr(str,'.'))
{
len = strlen(str);
p = len + str - 1;
while( *p == '0')
*(p--) = 0;
if (*p == '.')
*p = 0;
}
}
int main( )
{
while(scanf("%s%s",str1,str2)!= EOF)
{
deal(str1);
deal(str2);
if (strcmp(str1,str2) == 0)
puts("YES");
else
puts("NO");
}
return 0;
}
Give you two numbers A and B,if A is equal to B,you should print "YES",or print "NO".
Inputeach test case contains two numbers A and B.
Outputfor each case,if A is equal to B,you should print "YES",or print "NO".
Sample Input1 2
2 2
3 3
4 3
Sample OutputNO
YES
YES
NO
Time Limit:1000/1000 MS (Java/Others) Memory Limit:32768/32768 K (Java/Others)
Total Submission(s):38421 Accepted Submission(s):5912
#include
#include
#include
char str1[100000],str2[100000];
void deal(char *str)
{
int i,j,len;
char *p = str;
while( *p == '0')
p++;
strcpy(str,p);
if(strchr(str,'.'))
{
len = strlen(str);
p = len + str - 1;
while( *p == '0')
*(p--) = 0;
if (*p == '.')
*p = 0;
}
}
int main( )
{
while(scanf("%s%s",str1,str2)!= EOF)
{
deal(str1);
deal(str2);
if (strcmp(str1,str2) == 0)
puts("YES");
else
puts("NO");
}
return 0;
}
Give you two numbers A and B,if A is equal to B,you should print "YES",or print "NO".
Inputeach test case contains two numbers A and B.
Outputfor each case,if A is equal to B,you should print "YES",or print "NO".
Sample Input1 2
2 2
3 3
4 3
Sample OutputNO
YES
YES
NO
原理是去掉末尾多余的0和小数点(如果能去掉的话)还有多余的前导0
最后比较2字串
最后比较2字串
HDU 2054 A == B A但是看不太明白,
hdu 1002 A + B Problem II
ACM HDU 1002 A + B Problem II Runtime Error(ACCESS_VIOLATION
hdu 1002 A + B Problem II 一直wrong answer,请高手看看哪错了
hdu 2039#include#includeint main(){int t;int flag;float a,b,
不太明白的数学题:(a+b+c)^2=?
HDU 1039Problem DescriptionPassword security is a tricky thi
hdu
若a b互为相反数,那a+b=0,若a+b=0,那ab互为相反数.读了以上材料,你明白了什么
已知a(√1-b²)+b(√1-a²)=1,求证:a²+b²=1.(让我看明白并
hdu A有1数m,B来猜.B每猜一次,A就说"太大","太小"或"对了" .问B猜n次可以猜到的最大数.Input第1
hdu 1098 Ignatius is poor at math,he falls across a puzzle p