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 |
why g++ Runtime Error, 总是有时候G++ RE,但c++ ac,想弄清楚。谢希#include <stdio.h> #define MAX 1000010 int main() { #ifndef ONLINE_JUDGE freopen("in.txt","r",stdin); #endif __int64 n,i; short a[MAX],b[MAX],c[MAX]; scanf("%ld",&n); for (i=1;i<=n;i++) { scanf("%ld %ld",&a[i],&b[i]); c[i]=0; } for (i=n;i>=1;i--) { c[i]+=a[i]+b[i]; if (c[i]>9) { c[i-1]++; c[i]%=10; } } for (i=1;i<=n;i++) printf("%ld",c[i]); printf("\n"); } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator