# 【题解】- hdu A == B ?【注意坑。。。】

## A == B ?

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


#### AC代码

#include <stdio.h>
#include <string.h>
char arr[1000005], brr[1000005];
int main(void)
{
while(scanf("%s%s",&arr,&brr) != EOF)
{
int len_a = strlen(arr);
int len_b = strlen(brr);
int ans_a = 1;
int ans_b = 1;
if(len_a != len_b)
{
for(int i = 0; i < len_a; i++)
{
if(arr[i] == '.')
{
ans_a = 0;
}
}
if(ans_a)
{
arr[len_a] = '.';
}
for(int i = 0; i < len_b; i++)
{
if(brr[i] == '.')
{
ans_b = 0;
}
}
if(ans_b)
{
brr[len_b] = '.';
}
if(strlen(arr) < strlen(brr))
{
if(ans_a)
{
for(int i = len_a + 1; i < strlen(brr); i++)
{
arr[i] = '0';
}
}
else
{
for(int i = len_a; i < strlen(brr); i++)
{
arr[i] = '0';
}
}

}
if(strlen(arr) > strlen(brr))
{
if(ans_b)
{
for(int i = len_b + 1; i < strlen(arr); i++)
{
brr[i] = '0';
}
}
else
{
for(int i = len_b; i < strlen(arr); i++)
{
brr[i] = '0';
}
}

}
}

if(strcmp(arr,brr) == 0)
{
printf("YES\n");
}
else
{
printf("NO\n");
}
}
return 0;
}



#### 思路

©️2019 CSDN 皮肤主题: 1024 设计师: 上身试试