现在的位置: 首页 > 综合 > 正文

hdoj 2054

2019年07月31日 ⁄ 综合 ⁄ 共 457字 ⁄ 字号 评论关闭

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;
}

 

【上篇】
【下篇】

抱歉!评论已关闭.