上一页 1 2 3 4 5 6 7 ··· 13 下一页
摘要: 1 #include <iostream> 2 #include <cstdio> 3 #include <cstring> 4 #include <algorithm> 5 #define lson l,mid,i<<1 6 #define rson mid+1,r,i<<1|1 7 using namespace std; 8 const int Ni =100010; 9 int num[Ni],x[Ni];10 char op[Ni];11 int tn[Ni*3];12 long long tree[Ni*3][ 阅读全文
posted @ 2012-09-18 12:10 qijinbiao1 阅读(447) 评论(0) 推荐(0) 编辑
摘要: 1 #include <map> 2 #include <iostream> 3 #define ll long long 4 using namespace std; 5 const int MOD = 1000000007; 6 struct node{ 7 long long a1,a2,a3,a4; 8 node(){} 9 node(ll a,ll b,ll c,ll d){a1=a;a2=b;a3=c;a4=d;}10 };11 node gn=node(0,1,1,3);12 node org=node(0,1,1,3);13 node dw=node(. 阅读全文
posted @ 2012-09-17 11:37 qijinbiao1 阅读(258) 评论(0) 推荐(0) 编辑
摘要: 1 #include <cstdio> 2 #include <iostream> 3 using namespace std; 4 const int Ni = 505; 5 const int n = 500; 6 int eg[Ni][Ni]; 7 int deg[Ni],pos; 8 int path[Ni*5]; 9 void dfs(int s)10 {11 if(deg[s])12 for(int i=1;i<=n;i++) if(eg[s][i])13 {14 eg[s][i]--;15 ... 阅读全文
posted @ 2012-09-15 16:04 qijinbiao1 阅读(231) 评论(0) 推荐(0) 编辑
摘要: 1 #include <iostream> 2 #include <cstdio> 3 #include <cstring> 4 using namespace std; 5 const int Ni = 13; 6 const int mod = 100000000; 7 int map[Ni][Ni]; 8 int dp[Ni][1<<12]; 9 int n,m,add;10 void dfs(int i,int s0,int s,int cur)11 {12 if(cur>=m) {dp[i][s]=(dp[i][s]+add)%m 阅读全文
posted @ 2012-09-14 17:32 qijinbiao1 阅读(287) 评论(0) 推荐(0) 编辑
摘要: 题意:求1*2的牌填满n*m的表格有多少种不同的方法;状态压缩dp(注:思路来自不知名的大神)用2进制的01表示不放还是放第i行只和i-1行有关枚举i-1行的每个状态,推出由此状态能达到的i行状态如果i-1行的出发状态某处未放,必然要在i行放一个竖的方块,所以我对上一行状态按位取反之后的状态就是放置了竖方块的状态。然后用搜索扫一道在i行放横着的方块的所有可能,并且把这些状态累加上i-1的出发状态的方法数,如果该方法数为0,直接continue。举个例子2 411111111状态可以由1100 0000 0110 0011 11110000 0000 0000 0000 0000这五种i-1的状 阅读全文
posted @ 2012-09-13 22:00 qijinbiao1 阅读(1866) 评论(1) 推荐(1) 编辑
摘要: 1 #include <iostream> 2 #include <cstdio> 3 #include <cstring> 4 using namespace std; 5 const int Ni = 105; 6 const int inf = 1<<27; 7 int n,num[Ni],sum[Ni],d[Ni][Ni]; 8 inline int min(int a,int b) {return a<b? a:b;} 9 int dp(int i,int j)10 {11 int ans=inf;12 if(d[i][j]!=i 阅读全文
posted @ 2012-09-10 22:31 qijinbiao1 阅读(205) 评论(0) 推荐(0) 编辑
摘要: 1 #include <cstdio> 2 #include <map> 3 #include <iostream> 4 using namespace std; 5 struct node{ 6 int a,b; 7 bool operator < (const node &aa) const 8 { 9 if(a!=aa.a) return a<aa.a;10 else return b<aa.b;11 }12 };13 map<node,bool> m;14 int n,ans,sum;15 int arr[20] 阅读全文
posted @ 2012-09-08 19:40 qijinbiao1 阅读(391) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4353题意: 求多边形面积和这个多边形内的金矿数的比值的最小值。 当xi<xj<xk时: 三角形内的点数=|ik上方的点-(ij上方的点+jk上方的点)| 1 #include <iostream> 2 #include <cstdio> 3 #include <algorithm> 4 using namespace std; 5 const int Ni = 205; 6 const int Mi = 505; 7 int n,m; 8 double mx; 阅读全文
posted @ 2012-08-25 09:16 qijinbiao1 阅读(275) 评论(0) 推荐(0) 编辑
摘要: 1 #include <cstring> 2 #include <cstdio> 3 #include <iostream> 4 #include <cmath> 5 using namespace std; 6 char anum[1100],bnum[1100],ans[1100]; 7 int cs,i,j,len,t; 8 void swap(char &a,char &b){ 9 char temp=a;a=b;b=temp;10 }11 ///非负大整数乘法,时间复杂度为(2*len)^2,空间复杂度为2*len12 阅读全文
posted @ 2012-08-23 21:13 qijinbiao1 阅读(225) 评论(0) 推荐(0) 编辑
摘要: 题意: 两辆车去运一堆货物,货物数量小于等于10,问最少需要几趟能把货物全部运到目的地。 1 #include <iostream> 2 #include <cstdio> 3 using namespace std; 4 const int Ni = 1<<10; 5 const int INF = 1<<27; 6 int dp[Ni],g[Ni],weg[11]; 7 bool vis[Ni]; 8 int n,c1,c2,s; 9 bool judge(int x)//可以一次用两辆车运走返回true10 {11 int i,j,sum= 阅读全文
posted @ 2012-08-22 21:09 qijinbiao1 阅读(515) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 ··· 13 下一页