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:自己推了一个公式 :)

Posted by 605487807 at 2009-09-07 19:06:47 on Problem 1012
In Reply To:自己推了一个公式 :) Posted by:888899977 at 2007-10-12 17:25:56
> int f(int n,int m,int t)
> {
>     if(t==1) return (m-1)%n;
>     else return (m%n+f(n-1,m,t-1))%n;
> }//n人报m第t轮出列的人的编号(从0到n-1)
> 
> 这样就可以ac了。
在最后一个坏人出队时,报数的人只有两种可能,第一个好人,或者最后一个坏人,所以报的数只能是k+1的倍数或者是k+1的倍数加1,而倒数第二个人的死,以此类推,有这个剪枝,只要有第一步,就可出解了

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