Qiuqiqiu  
不管道路多么崎岖坎坷,我永远不停下追逐梦想的脚步!

2011年11月29日

摘要: 约瑟夫暴力枚举m的值就行了,怕超时的话就打表我的代码 1 #include <stdio.h> 2 const int N=30; 3 int f[14];//={0,2,7,5,30,169,441,1872,7632,1740,93313,459901,1358657,2504881}; 4 int k; 5 int ok(int m) 6 { 7 int n=2*k; 8 int flag[N]={0}; 9 int i,t,p=0;10 for (i=0;i<k;i++)11 {12 t=m%(n-i);13 if... 阅读全文
posted @ 2011-11-29 21:14 Qiuqiqiu 阅读(411) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1249f(n)=f(n-1)*(n-1)View Code 1 #include <stdio.h> 2 const int N=10001; 3 int f[N]={0,2}; 4 int main() 5 { 6 int T,i; 7 scanf("%d",&T); 8 for (i=2;i<N;i++) f[i]=f[i-1]+6*(i-1); 9 while (T--)10 {11 int n;12 scanf("%d",&n) 阅读全文
posted @ 2011-11-29 19:08 Qiuqiqiu 阅读(199) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1789贪心先安排分数大的作业,设它的期限为t,若第t天没被安排,则安排在第t天,否则往前找空闲时间,即t-1,t-2,t-3......1,直到找到第i天空闲,则安排在第i天,若前t天都被安排了,没有空闲时间,则这个作业无法完成另外当t>n时,可令t=n,n天足够完成所有作业了我的代码 1 #include <stdio.h> 2 #include <string.h> 3 #include <stdlib.h> 4 struct work 5 { 6 int s,t 阅读全文
posted @ 2011-11-29 18:36 Qiuqiqiu 阅读(290) 评论(0) 推荐(0) 编辑