#include <iostream>
#include <string>
#include <algorithm>
#include <fstream>
using namespace std;
void del(string &str);
int main()
{
string a, b;
#ifndef ONLINE_JUDGE
ifstream cin("d:\\UVa\\uva_in.txt");
#endif
while (cin >> a >> b)
{
del(a);
del(b);
if (a == b)
cout << "YES" << endl;
else
cout << "NO" << endl;
}
return 0;
}
void del(string &str)
{
string::iterator it;
int flag = 0;
for (it = str.begin(); it != str.end(); it++)
{
if (*it == '0')
{
str.erase(it);
it--;
}
else
break;
}
for (it = str.begin(); it != str.end(); it++)
if (*it == '.')
{
flag = 1;
break;
}
if (flag)
{
reverse(str.begin(), str.end());
for (it = str.begin(); it != str.end(); it++)
{
if (*it == '0')
{
str.erase(it);
it--;
}
else
break;
}
it = str.begin();
if (*it == '.')
str.erase(it);
reverse(str.begin(), str.end());
}
}
hdu2054 A == B ?
最新推荐文章于 2018-05-30 20:27:23 发布
本文展示了一段使用C++处理字符串并进行文件读写的代码示例,包括字符串过滤和文件输入输出的基本操作。
1925

被折叠的 条评论
为什么被折叠?



