hdoj 2054

来源:互联网 发布:js设置按钮禁用 编辑:程序博客网 时间:2024/06/05 14:43

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

//字符串题 要考虑各种情况,题目中没有说明两个数是什么样的数#include <iostream>#include <string>using namespace std;void func(string & a){ int k = a.length()-1; while (a[k]=='0') k--; if (a[k] == '.') k--; a.erase(a.begin()+k+1, a.end());}int main(){ string str1, str2; int i; while (cin >> str1 >> str2) {  if (str1.find(".") != string::npos) func(str1);  if (str2.find(".") != string::npos) func(str2);  //cout << str1 << endl << str2 << endl;  if (str1 == str2) puts("YES");  else puts("NO"); } return 0;}


 

原创粉丝点击