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 |
为什么这个代码wa啊?//把变量都用_int64,不用bool y;就能过. #include <stdio.h> int f(int b,int a) { int r; while(r=b%a) { b=a; a=r; } return a; } int main() { int a[50],n,c,i,t,r; bool y; double s; scanf("%d",&c); while(c--) { scanf("%d",&n); for(i=0;i<n;i++) scanf("%d",a+i); r=1; y=0; for(i=0;i<n;i++) { t=f(r,a[i]); a[i]/=t; s=r*a[i]; if(s>1000000000) { y=1; break; } r*=a[i]; } if(y)printf("More than a billion.\n"); else printf("%d\n",r); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator