摘要:
/*大致题意:n个城市,先把1号断电,继而每隔m断电使标号为2的最后被限电;转化为(n-1)个城市,最后断电的为标号为1的城市,求最小的m*/ #include<stdio.h>bool is_joseph(int m,int n){ int i,j; int s=0; for(i=2;i<=n;i++) s=(s+m)%i; if((s+1)==1) return 1; return 0;}int main(){ int i,j,k; int m,n,s; while(scanf("%d",&n),n) { ... 阅读全文
posted @ 2012-08-01 10:21
加拿大小哥哥
阅读(295)
评论(0)
推荐(0)
摘要:
JosephTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 40823Accepted: 15337DescriptionThe Joseph's problem is notoriously known. For those who are not familiar with the original problem: from among n people, numbered 1, 2, . . ., n, standing in circle every mth is going to be executed an 阅读全文
posted @ 2012-08-01 09:14
加拿大小哥哥
阅读(230)
评论(0)
推荐(0)

浙公网安备 33010602011771号