Give you two numbers A and B, if A is equal to B, you should print "YES", or print "NO".
#include<stdio.h>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<string.h>
using namespace std;
#define LEN 100000
int main()
{
char a[LEN], b[LEN];
int i, n1, n2;
while (scanf("%s %s", &a, &b) != EOF)
{
int a1 = 0, b1 = 0;
n1 = strlen(a);
n2 = strlen(b);
n1--;
n2--;
for (i = 0; i <= n1; i++)
{
if (a[i] == '.')
{
a1 = i;
break;
}
}
for (i = 0; i <= n2; i++)
{
if (b[i] == '.')
{
b1 = i;
break;
}
}
while (a[n1] == '0' && n1 > a1 && a1 != 0)
{
a[n1] = '\0';
n1--;
}
if (a[n1] == '.')
a[n1] = '\0';
while (b[n2] == '0' && n2 > b1 && b1 != 0)
{
b[n2] = '\0';
n2--;
}
if (b[n2] == '.')
b[n2] = '\0';
if (strcmp(a, b) == 0)
printf ("YES\n");
else printf ("NO\n");
}
return 0;
}