Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

贴上代码 自测的数据挺顺利的 为什么WA呢?

Posted by songyuchen at 2008-10-06 20:48:51 on Problem 1504

int main()
{long n,a[100000],b[100000],c[100000],i;
long qufan(long x);
 scanf("%d",&n);
 for (i=1;i<=n;i++) scanf("%d %d",&a[i],&b[i]); 
 
for (i=1;i<=n;i++)
   {a[i]=qufan(a[i]);
    b[i]=qufan(b[i]);   
    c[i]=a[i]+b[i];   
    c[i]=qufan(c[i]);     
          
       }     
 
for (i=1;i<=n;i++) printf("%d\n",c[i]);
  	
  return 0;
}


long qufan(long x)
{long m[10],j,k,s;
j=1;    
k=x % 10;
while (x!=0)
  {m[j]=k;
   x=x-k;
   x=x/10; 
   k=x%10;       
    j++;          
              }        
s=0;    
j--;
for (k=1;k<=j;k++)
  {s=s+m[k];
   s=s*10; 
      
      
      
  }    
    
    s=s/10;
                    
return(s);                      
}    

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator