上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 30 下一页
  2012年9月24日
摘要: 手写的next_permutation比库函数写的高了一倍的时间额。CODE:#include<iostream>#include<algorithm>#include<cstdlib>#include<cstdio>#include<cstring>usingnamespacestd;intmain(){intT;scanf("%d",&T);while(T--){intN,H;chars[20]={'\0'};scanf("%d%d",&N,&H);f 阅读全文
posted @ 2012-09-24 17:58 有间博客 阅读(161) 评论(0) 推荐(0) 编辑
摘要: #include<iostream>#include<algorithm>#include<cstdlib>#include<cstdio>#include<cstring>usingnamespacestd;chars[11];intmain(){inttimes=0;intT;scanf("%d",&T);while(T--){scanf("%s",s);intn=strlen(s);sort(s,s+n);do{printf("%s\n",s);}while(n 阅读全文
posted @ 2012-09-24 17:25 有间博客 阅读(125) 评论(0) 推荐(0) 编辑
摘要: #include<iostream>#include<algorithm>#include<cstdlib>#include<cstdio>#include<cstring>usingnamespacestd;chars[210];intmain(){while(~scanf("%s",s)){intn=strlen(s);sort(s,s+n);do{printf("%s\n",s);}while(next_permutation(s,s+n));}return0;} 阅读全文
posted @ 2012-09-24 17:18 有间博客 阅读(108) 评论(0) 推荐(0) 编辑
摘要: 无耻地使用了STL,BS自己。关于next_permutation的用法:http://www.slyar.com/blog/stl_next_permutation.htmlCODE:#include<iostream>#include<algorithm>#include<cstdlib>#include<cstdio>#include<cstring>usingnamespacestd;inta[1001];chars[1001];intmain(){while(scanf("%s",s)&& 阅读全文
posted @ 2012-09-24 17:03 有间博客 阅读(120) 评论(0) 推荐(0) 编辑
摘要: Sample Input2-20 20-30 20-10 -5010 -50Sample Output0 1 (-100 21)错误的测试数据,害人。CODE:#include<iostream>#include<cstdio>#include<cstring>usingnamespacestd;structnode{intx,y;}a[1001];intcnt;voidget(intn){inti,j,k;intcnt1,cnt2;for(i=-100;i<=100;i++){for(j=-100;j<=100;j++){cnt1=cnt2=0 阅读全文
posted @ 2012-09-24 12:48 有间博客 阅读(154) 评论(0) 推荐(0) 编辑
  2012年9月23日
摘要: 唔,最近感觉搜索好弱,明天开始做做搜索专题。CODE:#include<stdio.h>#include<stdlib.h>#include<queue>#include<string.h>usingnamespacestd;constintSIZE=52;intmaze[SIZE][SIZE][SIZE];intflag[SIZE][SIZE][SIZE];intl,r,c,T;constintdx[]={-1,1,0,0,0,0};constintdy[]={0,0,-1,1,0,0};constintdz[]={0,0,0,0,-1,1}; 阅读全文
posted @ 2012-09-23 21:16 有间博客 阅读(206) 评论(0) 推荐(0) 编辑
摘要: 网络流-最大流入门题。CODE:#include<iostream>#include<cstdlib>#include<cstdio>#include<cstring>#include<queue>usingnamespacestd;constintM=201;constintINF=0x3f3f3f3f;intflow[M][M],cap[M][M];inta[M],p[M];ints,t;intn,m;voidinit(){memset(p,0,sizeof(p));memset(cap,0,sizeof(cap));}intEK 阅读全文
posted @ 2012-09-23 16:00 有间博客 阅读(139) 评论(0) 推荐(0) 编辑
摘要: POJ 2449 Remmarguts' Date(中等)http://acm.pku.edu.cn/JudgeOnline/problem?id=2449题意:经典问题:K短路解法:dijkstra+A*(rec),方法很多相关:http://acm.pku.edu.cn/JudgeOnline/showcontest?contest_id=1144该题亦放在搜索推荐题中 POJ 3013 - Big Christmas Tree(基础)http://acm.pku.edu.cn/JudgeOnline/problem?id=3013题意:最简单最短路,但此题要过,需要较好的程序速度 阅读全文
posted @ 2012-09-23 15:15 有间博客 阅读(271) 评论(0) 推荐(0) 编辑
  2012年9月22日
摘要: 原来double可以存储比__int64更大的数(int)(pow(p, 1.0/n) + 0.5)CODE:#include<iostream>#include<cstdlib>#include<cstring>#include<cstdio>#include<cmath>usingnamespacestd;intmain(){doublen,p;while(~scanf("%lf%lf",&n,&p)){doubleans=(int)(pow(p,1.0/n)+0.5);printf(" 阅读全文
posted @ 2012-09-22 18:01 有间博客 阅读(138) 评论(0) 推荐(0) 编辑
摘要: 附录1:上机练习题参考题1.Programming BasicSicily 1830 SZ Fibonacci Sequence,递归函数,难度0Sicily 1795 Table tennis,几何题,难度0Sicily 1798 Alice and Bob,策略,难度0Sicily 1561 PRIME Number,难度1Sicily 1007 To and Fro,数组与下标(二维数组),难度1Sicily 1036 Crypto Columns,二维数组,字符串,排序,难度1Sicily 1813 M进制数问题,难度1Sicily 1814日期计算问题1.1直接枚举uva 1016. 阅读全文
posted @ 2012-09-22 16:47 有间博客 阅读(2723) 评论(0) 推荐(0) 编辑
上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 30 下一页