1060 Are They Equal(25 分)

#include
using namespace std;
int n;
string a,b;
string convert(string s,int &exp)
{
    int point=s.length(),firstnum=point;
    bool f=false;
    for(int i=0;i'0'&&s[i]<='9'&&s[i]!=0)firstnum=i,f=true;
        if(s[i]=='.')point=i,s.erase(s.begin()+i);
    }
    while(s[0]=='0'&&s.length()>1)s.erase(s.begin());
    if(s[0]=='0')exp=0;
    else exp=point-firstnum;
    string ans;
    ans+="0.";
    for(int i=0;i>n>>a>>b;
    int exp1,exp2;
    string x=convert(a,exp1);
    string y=convert(b,exp2);
    if(x==y)printf("YES "),cout<

你可能感兴趣的:(1060 Are They Equal(25 分))