| ||||||||||
| 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:其实,先踢这个坏人和先踢那个坏人没有区别In Reply To:其实,先踢这个坏人和先踢那个坏人没有区别 Posted by:cloverprince at 2007-06-03 19:27:23 > 知道当前有几个好人有几个坏人就行了。
> 知道下一个踢到的是好人还是坏人就行了。
恩,谢谢指点
下面是测试m是否符合要求的程序:
int
Jose(int k, int m)
{
badexe = 0;
int pos = 0;
int len = 2*k;
while (badexe<k)
{
pos = (pos+m-1) % len;
if (pos>=0 && pos<k)
break;
++badexe;
--len;
}
if (badexe == k)
return 1;
return 0;
}
但是,还是要打表记录以前的结果,不然还是超时,郁闷
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator