HDU 1054 A==B?
来源:互联网 发布:mac界面 编辑:程序博客网 时间:2024/05/29 04:58
一个很坑的存在,感觉需要注重很多地方,结果不多就两个地方就好。。。。。。。
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<stdio.h>
#include<string.h>
int main()
{
char a[100024],b[100024],a1[100024],b1[100024];
int i,la,lb,sign,j,k1,k2;
for (;scanf("%s%s",a,b)!=EOF;)
{
la=strlen(a),lb=strlen(b);
j=0;
sign=0;
k1=0;
k2=0;
for (i=0;i<la;i++)//去掉a的前导0
{
if(sign==0&&a[i]!='0')
sign=1;
if(sign==1)
a1[j++]=a[i];
if(a[i]=='.')
k1=1;
}
a1[j]='\0';
j=0;
sign=0;
for (i=0;i<lb;i++)//去掉b的前导0
{
if(sign==0&&b[i]!='0')
sign=1;
if(sign==1)
b1[j++]=b[i];
if(b[i]=='.')
k2=1;
}
b1[j]='\0';
la=strlen(a1);
lb=strlen(b1);
for (i=la-1;a1[i]!='.'&&k1==1;i--)//判断小数点后无意义的0,还要考虑是否要去掉小数点
{
if(a1[i]=='0')
a1[i]='\0';
else
k1=0;
}
if(k1==1)
a1[i]='\0';
for (i=lb-1;b1[i]!='.'&&k2==1;i--)
{
if(b1[i]=='0')
b1[i]='\0';
else
k2=0;
}
if(k2==1)
b1[i]='\0';
if(strcmp(a1,b1)==0)
printf("YES\n");
else
printf("NO\n");
}
return 0;
}
- HDU 1054 A==B?
- hdu-A == B ?
- A == B ? HDU
- hdu 6189 a^b%m=b^a%m
- hdu--2504 a,b,c (a,c)=b,已知a,b求c
- HDU 2054 A == B ?
- HDU 2054 A==B
- hdu acm 2054 A == B ?
- hdu - 2054 - A == B ?
- hdu 2054 A == B ?
- Hdu 2054 - A == B ?
- hdu 2054 A == B ?【JAVA】
- hdu 2054 A==B?
- HDU 2054 A == B ?
- hdu 2054 A==B?
- hdu 2054 A == B ?
- HDU--2054 -- A == B ? [字符串]
- HDU 2054 - A == B ?
- C++ GUI QT 第4版 之线程(二) 线程的同步(2)
- C# 变量占用字节数
- 打洞技术说明-得出结论
- 通用存储过程
- Android button事件响应处理
- HDU 1054 A==B?
- R12.0 / R12.1 : Oracle EBS Context Variables (文档 ID 458282.1)
- C++ GUI QT 第4版 之线程(二) 线程的同步(3)
- uuid生成
- LAMP 部署
- initrd 解压
- 1017. A除以B (20)
- PAT A 1029. Median (25)
- ubuntu12.04下phpstorm安装