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:怎么回事会WA,还有什么情况没有考虑到???是不是数据精度不够?In Reply To:怎么回事会WA,还有什么情况没有考虑到???是不是数据精度不够? Posted by:springtty at 2005-07-27 17:15:17 #include<stdio.h> #include<math.h> typedef int type; int main() { type n,k,i; double u; while(scanf("%d %d",&a,&b)!=EOF) { /* double dn,dk; dn=n*1.0; dk=k*1.0;*/ i=(n-k)/(k-1); printf("%d\n",n+k); } return 0; } 这个题要这样考虑 每次剩下的butt是一个数列 n n+1-k n+2-2k n+3-3k . . . n+i-ik 这样解下边的方程 n+i-ik<k 然后 printf("%d\n",n+i); 这样就不需要太多的考虑了 Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator