题目描述:
源码:
/**/
#include"iostream"
#include"string"
using namespace std;
string Standard(string str)
{
int start;
int len = str.length();
char * p = new char[len + 2];
start = 0;
if(str[0] == '-' || str[0] == '+')
{
p[0] = str[0];
start = 1;
}
else
{
p[0] = '+';
}
for(int i = start; i < len; i++)
{
if(str[i] == '0')
{
start++;
}
else
{
break;
}
}
bool hasDot = false;
for(int i = start; i < len; i++)
{
if(str[i] == '.')
{
hasDot = true;
break;
}
}
if(hasDot)
{
for(int i = len - 1; i >= start; i--)
{
if(str[i] == '0')
{
len--;
}
else
{
break;
}
}
}
int index = 1;
if(str[len - 1] == '.')
{
len--;
}
for(int i = start; i < len; i++)
{
p[index++] = str[i];
}
p[index] = '\0';
return string(p);
}
int main()
{
string a, b;
while(cin>>a>>b)
{
a = Standard(a);
b = Standard(b);
if(a == b)
{
cout<<"YES"<<endl;
}
else
{
cout<<"NO"<<endl;
}
}
return 0;
}