HDOJ 2054

#include<stdio.h>
#include<string.h>
int main()
{
    void d(char *s);
    char *pa,*pb,a[100000],b[100000];
    while(scanf("%s%s",&a,&b)!=EOF)
    {
        pa=a;
        pb=b;
        while(*pa=='0')
        {
            pa++;
        }
        while(*pb=='0')
        {
            pb++;
        }
        d(pa);
        d(pb);
        printf(strcmp(pa,pb)?"NO\n":"YES\n");
    }
    return 0;    
}
void d(char *s)
{
    int len=strlen(s);
    char *p=s+len-1;
    if(strchr(s,'.'))
    {
        while(*p=='0')
        {
            *p--=0;
        }
    }
    if(*p=='.')
    {
        *p=0;
    }
}

posted @ 2012-04-19 22:24  加拿大小哥哥  阅读(464)  评论(0编辑  收藏  举报