摘要: /*This Code is Submitted by billforum for Problem 1017 at 2012-02-17 22:42:30*/#include <cstdio>#include <iostream>#include <stdlib.h>#include <memory.h>#include <math.h>#include <string.h>using namespace std;int a[19];int main(){ int k,m,ans; a[10]=93313; a[11]=4 阅读全文
posted @ 2012-02-17 22:44 wuzhibin 阅读(421) 评论(0) 推荐(0)
摘要: /*This Code is Submitted by billforum for Problem 1016 at 2012-02-17 17:33:40*/#include <cstdio>#include <iostream>#include <stdlib.h>#include <memory.h>#include <math.h>#include <string.h>using namespace std;const int N=3510;const int M=50000;int pr[N+1],pn=0;boo 阅读全文
posted @ 2012-02-17 17:35 wuzhibin 阅读(233) 评论(0) 推荐(0)
摘要: Source CodeProblem: 2244 User: billforum Memory: 252K Time: 32MS Language: C++ Result: Accepted Source Code #include <cstdio>#include <iostream>#include <stdlib.h>#include <memory.h>#include <math.h>#include <string.h>using namespace std;int main(){ int n,m; while 阅读全文
posted @ 2012-02-17 17:07 wuzhibin 阅读(271) 评论(0) 推荐(0)
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2925Problem : 2925 ( Musical Chairs ) Judge Status : AcceptedRunId : 5366197 Language : G++ Author : billforumCode Render Status : Rendered By HDOJ G++ Code Render Version 0.01 Beta#include <cstdio>#include <iostream>#include <stdlib.h>#inc 阅读全文
posted @ 2012-02-17 16:08 wuzhibin 阅读(243) 评论(0) 推荐(0)
摘要: 经典的Joseph问题吧,说有n个要被处决的人(编号0~(n-1)),从0开始报数,报到(m-1)的会被杀掉,剩下的人继续从0开始报数,如此下去最后剩的一个人会存活下来: 很明显剩下未处死的人编号为0我们来研究一下相邻两次的操作:x:0 1 2 3 4 5 6 …………m-2 m-1 m m+1m+2.....n-1 (有n人)y:n-20 1 2 …… (有n-1人)对比这两次操作发现 同一人的序号 之间的关系:x=(y+m)%n因此可以从后往前递推: 存活人序号:(最后一次):t=0 (倒数第二次):t=(t+m)%2 (有2人) (倒数第三次):t=(t+m)%3 (有3... 阅读全文
posted @ 2012-02-17 16:06 wuzhibin 阅读(286) 评论(0) 推荐(0)
摘要: /*This Code is Submitted by billforum for Problem 1952 at 2012-02-17 13:29:48*/#include <cstdio>#include <iostream>#include <stdlib.h>#include <memory.h>#include <math.h>#include <string.h>using namespace std;const int N=1000005;int next[N];int main(){ string str; 阅读全文
posted @ 2012-02-17 13:32 wuzhibin 阅读(118) 评论(0) 推荐(0)