Qiuqiqiu  
不管道路多么崎岖坎坷,我永远不停下追逐梦想的脚步!
上一页 1 2 3 4 5 6 ··· 20 下一页

2012年11月24日

摘要: hdu 2120 Ice_cream's world I http://acm.hdu.edu.cn/showproblem.php?pid=2120 2012-12-22并查集算环的个数View Code 1 #include <cstdio> 2 using namespace std; 3 4 const int N=1010; 5 int fa[N]; 6 int find(int x) 7 { 8 return x==fa[x]?x:fa[x]=find(fa[x]); 9 }10 int main()11 {12 int n,m;13 while(... 阅读全文
posted @ 2012-11-24 11:50 Qiuqiqiu 阅读(111) 评论(0) 推荐(0) 编辑

2012年11月23日

摘要: hdu 3934 Summer holiday http://acm.hdu.edu.cn/showproblem.php?pid=3934旋转卡壳,凸包,最大三角形面积View Code 1 #include <cstdio> 2 #include <cmath> 3 #include <algorithm> 4 using namespace std; 5 6 const double eps=1e-8; 7 const double pi=acos(-1.0); 8 inline double dcmp(double d) 9 {10 return d 阅读全文
posted @ 2012-11-23 14:11 Qiuqiqiu 阅读(198) 评论(0) 推荐(0) 编辑

2012年11月19日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2594扩展KMPView Code 1 #include <cstdio> 2 #include <cstring> 3 using namespace std; 4 5 const int N=50010; 6 char s1[N],s2[N]; 7 int next[N],ext[N]; 8 void getnext(char *sp) 9 {10 next[0]=strlen(sp);11 int p=0;12 while(sp[p+1] && sp[p]==sp 阅读全文
posted @ 2012-11-19 18:32 Qiuqiqiu 阅读(136) 评论(0) 推荐(0) 编辑

2012年11月18日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1358KMPView Code 1 #include <cstdio> 2 using namespace std; 3 4 const int N=1000010; 5 char s[N]; 6 int fail[N]; 7 void getfail(char *sp) 8 { 9 fail[0]=-1;10 for(int i=1,j=-1;sp[i];i++)11 {12 while(j!=-1 && sp[i]!=sp[j+1]) j=fail[j];13 ... 阅读全文
posted @ 2012-11-18 19:02 Qiuqiqiu 阅读(97) 评论(0) 推荐(0) 编辑

2012年11月17日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1081求子矩阵最大的和二维转一维View Code 1 #include <cstdio> 2 using namespace std; 3 4 const int N=110; 5 int a[N][N],s[N][N]; 6 int f[N]; 7 int main() 8 { 9 int n;10 while(~scanf("%d",&n))11 {12 for(int i=1;i<=n;i++)13 for(int j=1;j<=n;... 阅读全文
posted @ 2012-11-17 23:13 Qiuqiqiu 阅读(143) 评论(0) 推荐(0) 编辑

2012年11月16日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=3652题意:求小于n是13的倍数且含有'13'的数的个数dp[i][j][k]i:第i位,j:余数为jk=0:不含131:3开头不含13 2:含13View Code 1 #include <cstdio> 2 #include <cstring> 3 using namespace std; 4 5 const int N=12; 6 int md[N]; 7 int dp[N][13][3]; 8 void getdp() 9 {10 md[0]=1;11 for( 阅读全文
posted @ 2012-11-16 21:53 Qiuqiqiu 阅读(1418) 评论(0) 推荐(0) 编辑

2012年11月6日

摘要: View Code 1 #include <cstdio> 2 #include <cstring> 3 using namespace std; 4 5 int dp[10][3]; 6 void getdp() 7 { 8 memset(dp,0,sizeof(dp)); 9 dp[0][0]=1;10 for(int i=1;i<=6;i++)11 {12 dp[i][0]=dp[i-1][0]*9-dp[i-1][1];13 dp[i][1]=dp[i-1][0];14 dp[i][2]=dp[i-1]... 阅读全文
posted @ 2012-11-06 23:24 Qiuqiqiu 阅读(572) 评论(0) 推荐(0) 编辑
 
摘要: 题意:求小于n的不含49的数的个数0:不含49;1:不含49,9开头;2:含49dp[i][0]=dp[i-1][0]*10-dp[i-1][1]; 不含49的数字前加任意数-9开头的数前加4dp[i][1]=dp[i-1][0]; 不含49的数字前加9dp[i][2]=dp[i-1][2]*10+dp[i-1][1]; 含49的数前加任意数 9开头的数前加4View Code 1 #include <cstdio> 2 #include <cstring> 3 using namespace std; 4 5 #define LL long long 6 int ma 阅读全文
posted @ 2012-11-06 21:08 Qiuqiqiu 阅读(237) 评论(0) 推荐(0) 编辑

2012年7月11日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2640View Code 1 #include <cstdio> 2 #include <cstring> 3 using namespace std; 4 5 const int N=110; 6 int n,m; 7 int mz[N]; 8 int d[N][260][260]; 9 void dfs(int p,int s0,int s1,int s2,int c,int r)10 {11 if(p>=m-1)12 {13 if(c>d[r][s1][s2]) d[ 阅读全文
posted @ 2012-07-11 16:43 Qiuqiqiu 阅读(237) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2280View Code 1 #include <cstdio> 2 using namespace std; 3 4 const int INF=110; 5 int n,m=5; 6 int d[1010][40]; 7 int mz[1010]; 8 void dfs(int p,int s,int t,int c,int r) 9 {10 if(p>=m)11 {12 if(c<d[r][t]) d[r][t]=c;13 return;14 ... 阅读全文
posted @ 2012-07-11 15:41 Qiuqiqiu 阅读(139) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 20 下一页