02 2017 档案

摘要:1 //简单的背包应用,奈何我摔了好几次 2 #include 3 #include 4 #define maxn 120000 5 int n[6]; 6 int a[maxn]; 7 int Room; 8 void zero_one_bag(int); 9 void complete_bag(int); 10 void multiple_bag(int,int); 11 ... 阅读全文
posted @ 2017-02-17 22:01 Posase 阅读(189) 评论(0) 推荐(0)
摘要:1 //找到数如何算即可 2 #include 3 int a[6000]={1}; 4 5 void Humble_Numbers(); 6 int minf(int,int,int,int); 7 8 int main() 9 { 10 Humble_Numbers(); 11 int n; 12 while(~scanf("%d",&n) &&... 阅读全文
posted @ 2017-02-17 19:59 Posase 阅读(274) 评论(0) 推荐(0)
摘要:详见大牛背包九讲(下载地址:http://pan.baidu.com/s/1b9edXW) 阅读全文
posted @ 2017-02-17 13:42 Posase 阅读(324) 评论(0) 推荐(0)
摘要:1 //我的dfs入门。将1~n一次填入数组然后打印。 2 #include 3 #include 4 int v[101]; 5 int a[101]; 6 void dfs(int,int); 7 8 int main() 9 { 10 int n; 11 while(~scanf("%d",&n)) 12 { 13 memset(... 阅读全文
posted @ 2017-02-17 12:54 Posase 阅读(330) 评论(0) 推荐(0)
摘要:1 //用c++的sort可以过 2 #include 3 int main() 4 { 5 int n; 6 while(~scanf("%d",&n)) 7 { 8 int ans,ant,num=0; 9 while(n--) 10 { 11 scanf("%d",&ant);... 阅读全文
posted @ 2017-02-16 20:37 Posase 阅读(264) 评论(0) 推荐(0)
摘要:1 //只需要一个数组存可用系统最高拦截高度 2 #include 3 int s[6000]; 4 int main() 5 { 6 int n; 7 while(~scanf("%d",&n)) 8 { 9 int ans=1,top=-1,x,i,j; 10 for(i=0; i= x) 20 ... 阅读全文
posted @ 2017-02-16 19:58 Posase 阅读(158) 评论(0) 推荐(0)
摘要:1 //大牛的多重背包二进制优化写法 2 #include 3 #include 4 int r[105],v[105],n[105]; 5 int a[1005]; 6 int Room; 7 8 void db(int,int,int); 9 void lb(int,int); 10 void wb(int,int); 11 12 int main() 13 { 14 ... 阅读全文
posted @ 2017-02-16 19:03 Posase 阅读(172) 评论(0) 推荐(0)
摘要:1 //完全背包,有待改良 2 #include 3 #include 4 typedef struct 5 { 6 int val,room; 7 } cus; 8 int an[10005]; 9 cus inf[505]; 10 int main() 11 { 12 int n; 13 scanf("%d",&n); 14 while(n-... 阅读全文
posted @ 2017-02-16 11:50 Posase 阅读(189) 评论(0) 推荐(0)
摘要:1 //01背包,详见背包九讲 2 #include 3 #include 4 typedef struct 5 { 6 int val,room; 7 } cus; 8 int an[1005]; 9 cus inf[1005]; 10 int main() 11 { 12 int n; 13 scanf("%d",&n); 14 while(... 阅读全文
posted @ 2017-02-15 18:18 Posase 阅读(213) 评论(0) 推荐(0)
摘要:1 #include 2 #define maxn 1000000 3 int cs[2][maxn]; 4 int know=0,angry=0; 5 int main() 6 { 7 for(int i=125; i<maxn; ++i) 8 { 9 10 if(i%1000==521 || i/10%1000==521 |... 阅读全文
posted @ 2017-02-14 17:59 Posase 阅读(147) 评论(0) 推荐(0)
摘要:1 #include 2 #include 3 bool prime(int n) 4 { 5 if(n==1) 6 return false; 7 int i,t=(int)sqrt(1.0*n); 8 for(i=2; i<=t; ++i) 9 if(!(n%i)) 10 return fals... 阅读全文
posted @ 2017-02-10 21:49 Posase 阅读(301) 评论(0) 推荐(0)
摘要:1 #include 2 3 int gys(int x,int y) 4 { 5 if(y) 6 gys(y,x%y); 7 else 8 return x; 9 } 10 11 int main() 12 { 13 int a,b; 14 while(~scanf("%d%d",&a,&b)) 15 ... 阅读全文
posted @ 2017-02-10 21:15 Posase 阅读(170) 评论(0) 推荐(0)
摘要:1 #include 2 int cus(int x,long long y) 3 { 4 long long temp = (long long)1 temp) 8 y-=temp; 9 cus(x-1,y); 10 } 11 int main() 12 { 13 int a; 14 long long b; 15 while... 阅读全文
posted @ 2017-02-10 21:06 Posase 阅读(320) 评论(0) 推荐(1)
摘要:1 //找规律。。。 2 #include 3 long long a[30]; 4 void cus(int t,long long x) 5 { 6 if(t>=30) 7 return ; 8 a[t]=x; 9 cus(t+1,3*x); 10 } 11 12 int main() 13 { 14 cus(1,3); 1... 阅读全文
posted @ 2017-02-10 18:44 Posase 阅读(202) 评论(0) 推荐(0)
摘要:1 //找规律即可,下附打表 2 #include 3 int main() 4 { 5 int n; 6 scanf("%d",&n); 7 while(n--) 8 { 9 int a,b; 10 scanf("%d%d",&a,&b); 11 printf("%lld\n",(long lon... 阅读全文
posted @ 2017-02-10 17:52 Posase 阅读(277) 评论(0) 推荐(0)
摘要:1 #include 2 int a[10001]; 3 int minn(int); 4 int maxn(int); 5 int main() 6 { 7 int n; 8 while(~scanf("%d",&n)) 9 { 10 int ans=0; 11 for(int i=0; i a[i+1]) 41 ... 阅读全文
posted @ 2017-02-07 15:57 Posase 阅读(102) 评论(0) 推荐(0)
摘要:1 #include 2 double a[51][6]; 3 int main() 4 { 5 int n,m,i,j,t; 6 double s,x; 7 while(~scanf("%d%d",&n,&m)) 8 { 9 for(i=0; i<n; ++i) 10 for(j=0; j<m; ++j... 阅读全文
posted @ 2017-02-04 15:06 Posase 阅读(131) 评论(0) 推荐(0)
摘要:1 //递归之美^_^ 2 #include 3 int change(int,int); 4 int main() 5 { 6 int m,n; 7 while(~scanf("%d%d",&m,&n) && m+n) 8 printf("%d\n",change(m,0)+change(n,0)); 9 } 10 11 int change... 阅读全文
posted @ 2017-02-02 20:55 Posase 阅读(174) 评论(0) 推荐(0)
摘要:1 #include 2 int main() 3 { 4 int n,k; 5 while(~scanf("%d%d",&n,&k)) 6 printf("%d\n",n<k?2:(n*2/k+(n*2%k?1:0))); 7 } 阅读全文
posted @ 2017-02-02 16:05 Posase 阅读(122) 评论(0) 推荐(0)
摘要:1 #include 2 int main() 3 { 4 int n; 5 scanf("%d",&n); 6 while(n--) 7 { 8 int h; 9 scanf("%d",&h); 10 if(h<=10) 11 puts("1"); 12 e... 阅读全文
posted @ 2017-02-02 13:18 Posase 阅读(116) 评论(0) 推荐(0)
摘要:1 #include 2 char roma[12][5]= {"I","II","III","IV","V","VI","VII","VIII","IX","X","XI","XII"}; 3 char s[5]; 4 void seek(); 5 int check(char*); 6 int main() 7 { 8 int n=1; 9 while( 阅读全文
posted @ 2017-02-02 13:11 Posase 阅读(192) 评论(0) 推荐(0)
摘要:1 //关于浮点数的比较,相减的差小于精度可以认为近似相等 2 #include 3 #define jd 1e-4 4 int main() 5 { 6 int n; 7 scanf("%d",&n); 8 while(n--) 9 { 10 double a,b,c; 11 scanf("%lf%lf%lf",... 阅读全文
posted @ 2017-02-02 12:46 Posase 阅读(127) 评论(0) 推荐(0)
摘要:1 #include 2 int main() 3 { 4 int n; 5 scanf("%d",&n); 6 for(int t=0; t<n; ++t) 7 { 8 if(t) 9 puts(""); 10 int m; 11 scanf("%d",&m); 12 ... 阅读全文
posted @ 2017-02-02 12:16 Posase 阅读(180) 评论(0) 推荐(0)
摘要:1 #include 2 int main() 3 { 4 int n,m; 5 scanf("%d",&n); 6 while(n--) 7 { 8 scanf("%d",&m); 9 printf("%d\n",m); 10 } 11 } 阅读全文
posted @ 2017-02-02 11:46 Posase 阅读(135) 评论(0) 推荐(0)
摘要:1 #include 2 int main() 3 { 4 int n,b; 5 while(~scanf("%d%d",&n,&b)) 6 printf("%d\n",n/b); 7 } 阅读全文
posted @ 2017-02-02 11:35 Posase 阅读(127) 评论(0) 推荐(0)
摘要:1 //A~Z是从大到小。。。 2 #include 3 int main() 4 { 5 int n; 6 char a,b; 7 scanf("%d",&n); 8 while(n--) 9 { 10 getchar(); 11 scanf("%c %c",&a,&b); 12 if(a... 阅读全文
posted @ 2017-02-02 00:23 Posase 阅读(173) 评论(0) 推荐(0)
摘要:1 //这是自己写的代码。。。很蠢,下附一dalao代码,又少,又快。。。。 2 #include 3 int ant(int,int); 4 void ans(int,int); 5 int main() 6 { 7 int n; 8 while(~scanf("%d",&n)) 9 { 10 if(n 3 void ans(int)... 阅读全文
posted @ 2017-02-02 00:01 Posase 阅读(174) 评论(0) 推荐(0)
摘要:1 #include 2 char s[1005]; 3 int main() 4 { 5 int n; 6 scanf("%d",&n); 7 while(n--) 8 { 9 int i,r,w,b; 10 scanf("%s",s); 11 for(i=r=w=b=0; s[i]!='\0';... 阅读全文
posted @ 2017-02-01 23:19 Posase 阅读(201) 评论(0) 推荐(0)
摘要:1 //递归就是快。。。 2 #include 3 char s[100]; 4 int lenth(char*); 5 int check(char*,int); 6 int main() 7 { 8 int n; 9 scanf("%d",&n); 10 while(n--) 11 { 12 scanf("%s",s); 13... 阅读全文
posted @ 2017-02-01 23:07 Posase 阅读(206) 评论(0) 推荐(0)
摘要:1 #include 2 typedef struct 3 { 4 int len,wid,num; 5 }cus; 6 cus a[1000]; 7 int main() 8 { 9 int n,m; 10 scanf("%d",&n); 11 while(n--) 12 { 13 int i,j,k; 14 ... 阅读全文
posted @ 2017-02-01 22:21 Posase 阅读(160) 评论(0) 推荐(0)
摘要:1 #include 2 int main() 3 { 4 int n; 5 scanf("%d",&n); 6 while(n--) 7 { 8 int m; 9 scanf("%d",&m); 10 int temp=0,ans=0; 11 for(int i=1; i<=m; ... 阅读全文
posted @ 2017-02-01 21:24 Posase 阅读(107) 评论(0) 推荐(0)
摘要:1 #include 2 int a[100]; 3 void q_sort(int*,int,int); 4 int main() 5 { 6 int t,n; 7 scanf("%d",&t); 8 while(t--) 9 { 10 scanf("%d",&n); 11 for(int i=0; iy) 34... 阅读全文
posted @ 2017-02-01 20:32 Posase 阅读(170) 评论(0) 推荐(0)
摘要:1 #include<stdio.h> 2 int main() 3 { 4 int n; 5 scanf("%d",&n); 6 while(n--) 7 { 8 int a,b; 9 char s; 10 scanf("%x%c%x",&a,&s,&b); 11 if(s=='+') 12 pr 阅读全文
posted @ 2017-02-01 16:45 Posase 阅读(169) 评论(0) 推荐(0)
摘要:1 #include 2 int a[100]; 3 int main() 4 { 5 int n; 6 while(~scanf("%d",&n) && n) 7 { 8 int i,j; 9 for(i=j=0; i<n; ++i) 10 { 11 scanf("%d",&a[i... 阅读全文
posted @ 2017-02-01 16:12 Posase 阅读(180) 评论(0) 推荐(0)
摘要:1 #include 2 #define PI 3.1415926 3 int main() 4 { 5 double r; 6 while(~scanf("%lf",&r)) 7 printf("%.0lf\n",PI*4/3*r*r*r); 8 } 阅读全文
posted @ 2017-02-01 15:29 Posase 阅读(144) 评论(0) 推荐(0)
摘要:1 #include 2 #include 3 char s[1010]; 4 int a[26]; 5 int main() 6 { 7 int n,maxa; 8 scanf("%d",&n); 9 while(n--) 10 { 11 scanf("%s",s); 12 memset(a,0,sizeof a... 阅读全文
posted @ 2017-02-01 15:13 Posase 阅读(145) 评论(0) 推荐(0)
摘要:1 #include 2 int main() 3 { 4 int n,m; 5 char s; 6 scanf("%d",&n); 7 while(n--) 8 { 9 scanf("%s%d",&s,&m); 10 if(s<'a') 11 s-='A'-1; 12 ... 阅读全文
posted @ 2017-02-01 14:39 Posase 阅读(115) 评论(0) 推荐(0)
摘要:1 #include 2 #include 3 int main() 4 { 5 int n; 6 scanf("%d",&n); 7 while(n--) 8 { 9 int m,i,ant,ans; 10 scanf("%d",&m); 11 m+=1; 12 ant=(int)... 阅读全文
posted @ 2017-02-01 14:27 Posase 阅读(144) 评论(0) 推荐(0)