80分求大佬解疑

P1307 [NOIP2011 普及组] 数字反转

iodwad @ 2017-02-13 13:12:28

#include <stdio.h>
#include <string.h>

char s[1000];

int i;

int main()
{
    gets(s);
    if(s[0]=='-')
            printf("-");
    for(i=strlen(s)-1;i>=0;i--)
    {    
        if(s[i]=='0' && s[i-1]!='0' && s[i+1]==NULL || s[i]=='-')
            continue;

        printf("%c",s[i]);
    }
    return 0;
}

by iodwad @ 2017-02-13 13:13:33

求助


by 洛洛lglglg @ 2017-02-13 21:13:27

思路不对,用2500试试就发现不对,人家不一定末尾只有一个0;


|