Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:怎么回事会WA,还有什么情况没有考虑到???是不是数据精度不够?

Posted by BU at 2006-02-13 11:48:20 on Problem 2509
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator