题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1266
C语言源码:
#include<stdio.h>
#include<string.h>
int main()
{
int n,i,zero,j;
char s[10001];
while(scanf("%d",&n)!=EOF)
{
while(n--)
{
getchar();
scanf("%s",s);
zero=(int)strlen(s)-1;
while(zero&&s[zero]=='0')
zero--;
i=0;
if(s[0]=='-')
{
printf("-");
i++;
}
for(j=zero;j>=i;j--)
printf("%c",s[j]);
if(zero+1<=(int)strlen(s))
{
for(j=zero+1;j<(int)strlen(s);j++)
printf("%c",s[j]);
}
printf("\n");
}
}
}