A == B ?
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 57842 Accepted Submission(s): 8895
Problem Description
Give you two numbers A and B, if A is equal to B, you should print "YES", or print "NO".
Input
each test case contains two numbers A and B.
Output
for each case, if A is equal to B, you should print "YES", or print "NO".
Sample Input
1 2 2 2 3 3 4 3
Sample Output
NO YES YES NO
这道题就是个大坑,想考的是大数,我在网上看到一些同学的代码,想的真多,我不得不说思维确实严密,其实他就是想考小数点后面的0,把小数点后的多余0消掉
但这个考的是大数,所以是long long都不好用,只好用数组,就这些 看代码
但这个考的是大数,所以是long long都不好用,只好用数组,就这些 看代码
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;
void tras( char a[])
{
int len ,i;
len=strlen(a);
if(strstr(a,"."))//到小数点结束
{
for( i=len-1;a[i]=='0';i--)
{
a[i]='\0';
len--;
}
}
if(a[len-1]=='.')
{
a[len-1]='\0';
}
}
int main()
{
char a[100000],b[100000];//需要这么大,刚开始我设小了一直不过!
while(cin>>a>>b)
{
tras(a);
tras(b);
if(strcmp(a,b)==0)
cout<<"YES"<<endl;
else
cout<<"NO"<<endl;
}
return 0;
}