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

HDU-2054-A == B ?

时间:2014-12-08 17:05:22      阅读:164      评论:0      收藏:0      [点我收藏+]

标签:http   io   ar   sp   for   bs   代码   ef   tt   

题目链接

http://acm.hdu.edu.cn/showproblem.php?pid=2054

这题只要处理小数点后面无效的‘0‘或‘.‘   strstr()函数是两个字符串 需用“”号

代码

#include<string.h>
#include<stdio.h>

char a[100000],b[100000];

void chu_li(char s[])
{
int i;
int len=strlen(s);
if(strstr(s,"."))
{
for(i=len-1;s[i]==‘0‘;i--)
{
s[i]=‘\0‘;
}
if(s[i]==‘.‘)
s[i]=‘\0‘;
}
}

int main(void)
{
int i,j,k;
while(scanf("%s%s",a,b)==2)
{
chu_li(a);
chu_li(b);
if(strcmp(a,b))
printf("NO\n");
else
printf("YES\n");
}
return 0;
}

HDU-2054-A == B ?

标签:http   io   ar   sp   for   bs   代码   ef   tt   

原文地址:http://www.cnblogs.com/liudehao/p/4151140.html

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