| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re:为什么这样是错的?要字符存储有什么好处?In Reply To:为什么这样是错的? Posted by:jince at 2009-10-23 19:10:58 > #include<stdio.h>
> int s[1000000];
> int main()
> {
> int n,k,i,m;
> int x,y;
> scanf("%d",&n);
> for(i=0;i<n;i++)
> {
> scanf("%d %d",&x,&y);
> s[i]=x+y;
> }
> k=0;
> for(i=n-1;i>=0;i--)
> {
>
> m=s[i]%10+k;
> k=s[i]/10;
> s[i]=m;
> }
> for(i=0;i<n;i++)
> printf("%d",s[i]);
> printf("\n");
> return 0;
> }
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator