1.Are They Equal
有点离谱的一题
#include<cstdio>
#include<vector>
#include<cstring>
#include<string>
#include<stack>
#include<set>
#include<map>
#include<ctime>
#include<queue>
#include<math.h>
#include<algorithm>
#include<iostream>
using namespace std;
typedef long long ll;
int n;
string deal(string s,int &e){
while(s.length()>0&&s[0]=='0'){
s.erase(s.begin());
}
if(s[0]=='.'){
s.erase(s.begin());
while(s.length()>0&&s[0]=='0'){
s.erase(s.begin());
e--;
}
}else{
int pos=0;
while(pos<s.length()&&s[pos]!='.'){
pos++;
e++;
}
if(pos<s.length()){
s.erase(s.begin()+pos);
}
}
if(s.length()==0) e=0;
string ans;
int ans_num=0,s_pos=0;
while(ans_num<n){
if(s_pos<s.length()) ans+=s[s_pos++];
else ans+='0';
ans_num++;
}
return ans;
}
int main(){
string s1,s2,s3,s4;
cin>>n>>s1>>s2;
int e1=0,e2=0;
s3=deal(s1,e1);
s4=deal(s2,e2);
if(s3==s4&&e1==e2){
cout<<"YES 0."<<s3<<"*10^"<<e1<<endl;
}else{
cout<<"NO 0."<<s3<<"*10^"<<e1<<" 0."<<s4<<"*10^"<<e2<<endl;
}
return 0;
}