07 2012 档案
摘要:入门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]; ...
阅读全文
摘要: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]; ...
阅读全文
摘要:用了老办法,没啥新意,只是自己写了个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]; ...
阅读全文
摘要:就机会复习一下并查集… 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...
阅读全文
摘要:用了个很笨的办法~ 同时学会了使用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...
阅读全文
摘要: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...
阅读全文
摘要: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 ...
阅读全文
摘要: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...
阅读全文
摘要: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=
阅读全文
摘要: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
阅读全文
摘要:1 #include<iostream> 2 using namespace std; 3 const int maxn=10000; 4 int a[maxn]; 5 int n,k; 6 bool prime(int now) 7 { 8 if (now<2) return false; 9 if (now==2) return true;10 for (int i=2;i<now;i++){if (now%i==0) return false;}11 return true;12 }13 void get_input()14 {15 c...
阅读全文
摘要:1 #include<iostream> 2 using namespace std; 3 char a[100][100]; 4 int x[10000]; 5 int y[10000]; 6 bool vis[100][100]; 7 int n=0,m=0,tot=0,stx,sty; 8 void get_input() 9 {10 cin >> n >> m;11 for (int i=0;i<n;i++)12 for (int j=0;j<m;j++){ 13 cin >> a[i][j];14 vis[i...
阅读全文
摘要:1 #include<iostream> 2 #include<string> 3 using namespace std; 4 string monkey_name; 5 int a[150]={0}; 6 bool prime(int pre) 7 { 8 if (pre<2) return false; 9 if (pre==2) return true;10 for (int i=2;i<pre;i++) if (pre%i==0) return false;11 return true; 12 }13 int main()14 {1...
阅读全文
摘要:为了迎合即将到来的大学专业生活,我开始华丽丽地由Pascal转C++了…写的不好,切忌吐槽 1 #include<iostream> 2 using namespace std; 3 int t,n,ut,ft,dt; 4 const int size = 100000; 5 int a[size]; 6 void get_input() 7 { 8 char tmp; 9 cin >> t >> n >> ut >> ft >> dt; 10 for (int i=0;i<n;i++){11 cin >>
阅读全文
浙公网安备 33010602011771号