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

2011年11月26日

摘要: 算法1:类似于筛选法求素数算法2:类似于求最长上升子序列O(nlogn)的算法 (View Code 1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <string.h> 4 const int N=5010; 5 struct stick 6 { 7 int l,w; 8 }a[N]; 9 int f[N];10 int cmp(const void *a,const void *b)11 {12 stick *a1=(stick*)a;13 stick *b1=(stick*)b;14 if ( 阅读全文
posted @ 2011-11-26 19:59 Qiuqiqiu 阅读(187) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2093View Code 1 #include <stdio.h> 2 #include <string.h> 3 #include <stdlib.h> 4 struct student 5 { 6 char name[15]; 7 int s,t; 8 }a[1000]; 9 char s1[15];10 int n=0,m,tt;11 int cmp(const void *a,const void *b)12 {13 student *a1=(student*)a; 阅读全文
posted @ 2011-11-26 15:10 Qiuqiqiu 阅读(345) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2037DP先按开始时间(t.s)排序 f[i]记录看第i个节目时,最多可看的节目数fori:=1 to n do for j:=1 to i-1 do if t[i].s>=t[j].e then f[i]:=max(f[i],f[j]+1);View Code 1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <string.h> 4 const int N=110; 5 struct tv 6 { 7 in 阅读全文
posted @ 2011-11-26 12:10 Qiuqiqiu 阅读(231) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1197View Code 1 #include <stdio.h> 2 int main() 3 { 4 const int A=10000; 5 int s1,s2,s3,a=2992,t; 6 s1=s2=s3=0; 7 while (a<A) 8 { 9 for (s1=0,t=a;t>0;t/=10) s1+=t%10;10 for (s2=0,t=a;t>0;t/=12) s2+=t%12;11 for (s3... 阅读全文
posted @ 2011-11-26 08:41 Qiuqiqiu 阅读(207) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2104最大公约数=1是YESView Code 1 #include <stdio.h> 2 int gcd(int x,int y) 3 { 4 return y==0?x:gcd(y,x%y); 5 } 6 int main() 7 { 8 int m,n; 9 while (scanf("%d%d",&m,&n) && m!=-1 && n!=-1)10 if (gcd(m,n)>1) printf("POO 阅读全文
posted @ 2011-11-26 07:56 Qiuqiqiu 阅读(127) 评论(0) 推荐(0) 编辑