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:Running Time errorIn Reply To:Running Time error Posted by:00846086 at 2009-01-31 15:26:57 我用 VC 调试,稍微修改一下,把读数据的过程换成直接赋值,如下,让 n 等于1234567,运行到☆位置时,n突然变成了11,请问是VC的问题么? #include "stdio.h" int main() { long n; int a[100005]={0},b=0,c=0; long i; scanf("%ld",&n); for(i=0;i<n;i++){ // scanf("%d%d",&b,&c); b=(i)%10; c=(i+1)%10; // printf(" %d %d\n",b,c); a[i]=b+c; } for(i=n-1;i>0;i--){ if(a[i]>9){ a[i-1]++; a[i]%=10; } } printf("%d",a[0]%10); ☆☆ for(i=1;i<n;i++) printf("%d",a[i]); putchar('\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