Hduoj2054【水题】
来源:互联网 发布:电工仿真软件 编辑:程序博客网 时间:2024/05/22 00:44
/*A == B ?Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 64017 Accepted Submission(s): 10012Problem DescriptionGive 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 22 23 34 3 Sample OutputNOYESYESNO Author8600 && xhd Source校庆杯Warm Up */ #include<stdio.h>#include<string.h>char a[10000000], b[10000000];int find(char * s){int i = strlen(s);while(s[i] != '.' && i)i--;if(i==0)return strlen(s);else return i; }int main(){while(scanf("%s%s", a, b) != EOF){int m , n, i, j, k, l1,l2, p1, p2;m = strlen(a);n = strlen(b);p1 = find(a);for(i = 0; i < p1; i++)if(a[i] != '0'){l1 = i;break;}if(i == p1)// 数点前全部为0 或者 字符串全部为0 l1 = p1-1; //从 前一位开始比较 p2 = find(b);for(j = 0; j < p2; j++)if(b[j] != '0'){l2 = j;break;}if(j == p2)l2 = p2-1; for(i = m-1; i >= p1; i --)//去尾0 if(a[i] =='0' || a[i] == '.')a[i] = '\0';else break;for( j = n-1; j >= p2; j --)if(b[j] == '0' || b[j] == '.')b[j] = '\0';elsebreak;if(strcmp(a+l1, b+l2) == 0)printf("YES\n");elseprintf("NO\n"); }return 0;}
0 0
- Hduoj2054【水题】
- 水题
- 水题
- 水题
- 水题
- 【水题】
- 水题
- 水题:
- 水题
- 水题~
- 水题
- 水题
- 水题
- 水题
- 水题
- 水题
- 【水题】
- 水题
- 开发电商网站遇到的问题、解决方法、心得感想
- opencv中文手册
- CentOS 6.5安装MongoDB 2.6(多yum数据源)
- 图算法总结
- 深拷贝和浅拷贝
- Hduoj2054【水题】
- C++ lambda简单了解
- 【Hibernate知识点一】hibernate环境搭建及简单xml、annotation配置
- Go 1.4中值得关注的几个变化
- Linux系统CentOS6的安装方法
- 二叉搜索树的非递归前中后序遍历 【微软面试100题 第四十三题】
- Hibernate对象的CRUD操作
- 把eclipse项目部署到tomcat插件上报配置文件找不到IOException的问题
- 客户端SMTP和POP3举例