HDU 2054
2014-08-03 13:54
246 查看
HDU 2054 A==B?
#include<iostream> #include<cstdio> #include<cmath> #include<cstring> #include<string> #include<algorithm> #include<cstdlib> #include<queue> #define N 1006 using namespace std; void Change(string &str) { if(strchr(str.c_str(),'.'))//判断字符串str中是否有'.' { int lenstr = str.length(); while(str[--lenstr] == '0') str.erase(lenstr,1);//将后面的0删除 if(str[lenstr] == '.') str.erase(lenstr,1);//如果最后一个字符是'.',删除 } while(str[0] == '0')//将字符串中前面的0删除 { if(str.length() != 1) str.erase(0,1);//如果全部都是0,保留一个0 else return ; } } int main() { #ifdef ONLINE_JUDGE #else //freopen("E:\\我的程序\\in.txt","r",stdin); //freopen("E:\\我的程序\\out.txt","w",stdout); #endif string a, b; while(cin >> a >> b) { Change(a); Change(b); if(a.compare(b) == 0) cout << "YES" << endl;//判断字符串a,b是否相等 else cout << "NO" << endl; } return 0; }
相关文章推荐
- hdu 2054A==B?
- HDU ——2054 ——A==B?
- HDU 2054
- HDU 2054 A==B?
- HDU 2054 又见GCD(水题??)
- hdu 2054
- Hdu 2054 A == B ?
- HDU-2054 A == B ?(高精度字符是否值相同)
- HDU 2054
- hdu 2054 A == B ?【JAVA】
- HDU 2054 A == B ? (字符串处理)
- hdu 2054 A==B?
- HDU 2054 A==B?
- HDU_2054——A=B问题
- HDU 2054 又见GCD
- HDU 2054 A == B ?
- hdu 2054 A == B ?【JAVA】
- hdu 2054 A == B ? (java大数)
- hdu 2054
- HDU 2054 A==B?