Too many or too few lines?

P1307 [NOIP2011 普及组] 数字反转

whitewater @ 2016-11-07 21:52:59

#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
long n=1,head=0,k=-1,i,j=0,x;
long a[110]={0};
char a1[110]={0};
int main()
{
  scanf("%s",&a1[0]);
  x=strlen(a1);
  if(a1[0]=='-')
  {
  j=1;
  x-=1;
  }
  for(i=1;i<=x;i++)
  {
     a[i]=a1[j]-'0'; 
     if(a[i]==0&&k<i)
     head++;
     if(a[i]!=0)
     head=0;
     j++;
  }
  if(j==i)
  printf("-");
  for(i=x-head;i>=1;i--)
  printf("%ld",a[i]);
  return 0;
}

by llxz @ 2016-11-15 18:56:30

hehe


by 非原始团子 @ 2016-12-08 16:05:59

Too many


|