A == B ? HOJ2054 (字符串(小数点))
来源:互联网 发布:云计算有什么意义 编辑:程序博客网 时间:2024/06/06 10:56
A == B ?
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 153 Accepted Submission(s): 68Problem 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 22 23 34 3
Sample Output
NOYESYESNO
。。。这个题不存在前导零(哇。 考虑 1. 1 1.000 这些特殊情况。
本弱直接用的 std::string
#include <iostream>#include <cmath>#include <string>#include <algorithm>#include <string.h>using namespace std;int main() { string a, b; while (cin >> a >> b) { if (a.find('.') < a.size()) { while (a.end() != a.begin()) { if (*(a.end() - 1) == '0') { a.erase(a.end() - 1); } else break; } if(*(a.end()-1) == '.') a.erase(a.end() - 1); } if (b.find('.') < b.size()) { while (b.end() != b.begin()) { if (*(b.end() - 1) == '0') { b.erase(b.end() - 1); } else break; } if(*(b.end()-1) == '.') b.erase(b.end() - 1); } //cout << "|" << a << "| |" << b <<"|"<< endl; if (a == b) cout << "YES" << endl; else cout << "NO" << endl; } }
阅读全文
0 0
- A == B ? HOJ2054 (字符串(小数点))
- HDU 2054 A == B ?(找小数点)
- G - A == B ?(字符串处理)
- BFS:HDU2054-A==B?(字符串的比较)
- HDOJ1228(字符串A+B)
- 有两个浮点数a,b,计算a/b,要求保留小数点后面n 位(我写出小数点只能保存9~15位有效位数)
- 求a/b的小数点后某个具体的数值(Position in Fraction)
- *gcd(a,b)==a^b
- HDU--2054 -- A == B ? [字符串]
- hdoj 2054 A == B ? 【字符串】
- HDU 2054 A == B? 【字符串】
- 算法C++ 【字符串】A == B ?
- 2054 A == B ?【字符串】
- 字符串 HDU 2054 A == B ?
- HDU2054-A == B ?【字符串处理】
- HDOJ3787(A+B)(字符串处理)
- HDU-1228-A+B(字符串处理)
- HPUOJ1163: 大数A + B [字符串](水)
- linux防火墙之iptables和NAT
- ios系统中各种设置项的url链接
- Python进阶(五十二)-Flask使用pymysql连接MySQL数据库
- spark graphx 2.1 -- Summary List of Operators
- Tomcat之JVM内存查查看
- A == B ? HOJ2054 (字符串(小数点))
- FileMessageSet分析
- STL-- set
- log4j日志输出,以及生成日志文件
- leetcode 114. Flatten Binary Tree to Linked List
- css布局之三角戳布局
- thinkphp5 , tp5 导入 Excel ,phpExcel 插件使用,文件上传
- 偷来的支持切换的分类列表
- 如何在页面上呈现谷歌地图