嗯 还是 暴

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

#include<stdio.h>
#include<string.h>
int main()
{
    char a[900000],b[900000];
    int i,x,z,t,l,n,j,y;
    for(i=0;i<n;i++)
    {
        a[i]=b[i]='0';
    }
    while(scanf("%s%s",a,b)!=EOF)
    {
        x=0;
        t=strlen(a);
        l=strlen(b);
        if(t>l)
        n=t;
        else
        n=l;
        for(i=0;i<n;i++)
        {
            if(a[i]!=b[i]&&(a[i]!='.'&&b[i]!='.'))
            x=1;
            if(a[i]=='.'||b[i]=='.')
            {
               i=i+1;
               y=n;
               z=n;
               for(j=n-1;j>=i;j--)
               {
                   if(a[j]==0)
                   y--;
                   if(b[j]==0)
                   z--;
               }
               if(z>y)
               n=y;
               else
               n=z;
               for(j=i;j<n;j++)
               {
                   if(a[j]!=b[j])
                   x=1;
                }
                break;    
            }
        }
        if(x)
        printf("NO\n");
        else
        printf("YES\n");
    }
    return 0;
}


阅读更多
想对作者说点什么?

博主推荐

换一批

没有更多推荐了,返回首页