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 |
大家帮忙看一下第几个数据出的错?thanks!#include<stdio.h> #include<math.h> void main() { int i,num,ce; long double t; long n,a[10]; scanf("%d",&num); for(i=0;i<num;i++) scanf("%ld",&a[i]); for(i=0;i<num;i++) { ce=1; t=(long double)a[i]/8+1.0/64; n=(long)(sqrt(t)*4-0.5); if(n%2==0) ce=0; if(ce==1) { if(a[i]==n*((n+1)/2)) printf("%ld\n",n); else printf("%ld\n",a[i]-n*((n+1)/2)); } else if(ce==0) { if(a[i]==n/2*(n+1)) printf("%ld\n",n); else printf("%ld\n",a[i]-n/2*(n+1)); } } } 提交时说wrong answer!到底哪个出的错啊,我实在找不出来。希望高手给找找,或者发一个已经测试通过的程序,感激啊!!! Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator