摘要: 入门DP,直接贴代码 1: #include<iostream> 2: #include<string.h> 3: using namespace std; 4: 5: int n,ans=0; 6: const int maxn=5000; 7: int f[maxn],a[maxn]; ... 阅读全文
posted @ 2012-07-10 21:34 NoRush 阅读(402) 评论(0) 推荐(0) 编辑
摘要: 1: #include<iostream> 2: #include<string.h> 3: #include<math.h> 4: using namespace std; 5: int m,n; 6: const int maxn=100000; 7: int w[maxn],f[maxn*50]; ... 阅读全文
posted @ 2012-07-09 20:54 NoRush 阅读(481) 评论(0) 推荐(0) 编辑
摘要: 用了老办法,没啥新意,只是自己写了个sort 1: #include<iostream> 2: #include<string.h> 3: using namespace std; 4: int m,n; 5: const int maxn=100001; 6: int a[maxn],pos[maxn]; ... 阅读全文
posted @ 2012-07-07 21:06 NoRush 阅读(315) 评论(0) 推荐(0) 编辑
摘要: 就机会复习一下并查集… 1: #include<iostream> 2: #include<string.h> 3: using namespace std; 4: const int maxn=1001; 5: int f[maxn]; 6: int n,m,tot=0; 7: 8: in... 阅读全文
posted @ 2012-07-07 20:42 NoRush 阅读(207) 评论(0) 推荐(0) 编辑
摘要: 用了个很笨的办法~ 同时学会了使用string.h里的memset 1: #include<iostream> 2: #include<string.h> 3: using namespace std; 4: const int maxv=2000000; 5: int v[maxv]={0}; 6: boo... 阅读全文
posted @ 2012-07-07 20:20 NoRush 阅读(1184) 评论(0) 推荐(0) 编辑
摘要: 1: #include<iostream> 2: using namespace std; 3: int m,n,k,l,d; 4: const int maxn=3000; 5: int hen[maxn]={0},shu[maxn]={0},posh[maxn]={0},poss[maxn]={0}; 6: bo... 阅读全文
posted @ 2012-07-05 14:03 NoRush 阅读(802) 评论(0) 推荐(0) 编辑
摘要: 1 #include<iostream> 2 using namespace std; 3 const int maxn=30; 4 int n,px,py; 5 int a[maxn][maxn],f[maxn][maxn]; 6 7 void get_prepare() 8 { 9 cin >> n;10 for (int i=0;i<n;i++)11 for (int j=0;j<=i;j++){12 cin >> a[i][j];13 f[i][j]=a[i][j];14 }15 ... 阅读全文
posted @ 2012-07-04 20:05 NoRush 阅读(961) 评论(0) 推荐(0) 编辑
摘要: 1 #include<iostream> 2 #include<string> 3 using namespace std; 4 string st; 5 int a[9]={0}; 6 int diag=0; 7 8 void get_prepare() 9 {10 cin >> st;11 a[0]=(int)st[0]-48;12 a[1]=(int)st[2]-48;13 a[2]=(int)st[3]-48;14 a[3]=(int)st[4]-48;15 a[4]=(int)st[6]-48;16 a[5]=(int)st... 阅读全文
posted @ 2012-07-04 19:31 NoRush 阅读(349) 评论(0) 推荐(0) 编辑
摘要: 1 #include<iostream> 2 using namespace std; 3 const int maxn=100; 4 int t,n; 5 int c[maxn]={0},w[maxn]={0},f[maxn]={0}; 6 void get_input() 7 { 8 cin >> t >> n; 9 for (int i=0;i<n;i++) cin >> c[i] >>w[i];10 }11 void pack()12 {13 for (int i=0;i<n;i++){14 for (int j= 阅读全文
posted @ 2012-07-04 18:14 NoRush 阅读(566) 评论(0) 推荐(0) 编辑
摘要: 1 #include<iostream> 2 using namespace std; 3 const int maxn=100,maxm=100; 4 const int dirx[4]={0,0,1,-1}; 5 const int diry[4]={1,-1,0,0}; 6 int n,m,maxx=0; 7 int a[maxn][maxm],dis[maxn][maxm]={0}; 8 9 void get_input()10 {11 cin >> n >> m;12 for (int i=0;i<n;i++){13 for (int j=0 阅读全文
posted @ 2012-07-04 17:41 NoRush 阅读(1073) 评论(0) 推荐(0) 编辑