IT民工
加油!
上一页 1 2 3 4 5 6 7 ··· 29 下一页
摘要: 今天做的是辽宁2010年的省赛题。题目难度比昨天容易了不少。悲哀的是,我们队只把前四道水题做出来了,后面还有两道相对容易的题没做出来。A :DinnerA题是我敲的,开始看到题的时候还愣了一下,后面看到hint的提示,才发现如此之水。题意大致是给你N个盒子,盒子里面放着一样东西,如果是餐具就输出,注意下格式就可以,餐具在hint中给出了,才四种...#include <stdio.h>#include <string.h>#include <stdlib.h>const char table[][15] = {"bowl", " 阅读全文
posted @ 2012-10-02 15:46 找回失去的 阅读(167) 评论(0) 推荐(0) 编辑
摘要: 国庆这几天都是做比赛,从今天的情况来说,感觉我还是弱了一点,有些该出的题没做出来,模拟题做得比较少,该考虑的情况没有考虑,所以E题写了一半,脑子就乱了没写下去,交给了队友。有一种感觉是学了的东西用不上,或者说不会用,还有好多东西没学。POJ 3311Hie with the Pie这道题其实隽遒学弟的思路没有错,先floyd求出任意两点间的最短路,然后就是旅行商问题(哈密顿回路),也可以说是状态压缩DP。最多一共就2的11次方乘以10种状态,用f[i][j]表示第i种状态处于j点的最小代价,我们要求的就是f[(1 <<(n + 1) - 1)[0],从零点出发回到零点。#inclu 阅读全文
posted @ 2012-10-01 23:43 找回失去的 阅读(198) 评论(0) 推荐(0) 编辑
摘要: K短路dij+Astar。/*Accepted 9904K 282MS C++ 2223B 2012-09-28 15:30:02*/#include <stdio.h>#include <string.h>#include <stdlib.h>#include <algorithm>#include <queue>using namespace std;const int INF = 0x3f3f3f3f;const int MAXN = 1 << 10;const int MAXM = 100 * MAXN;typed 阅读全文
posted @ 2012-09-28 15:36 找回失去的 阅读(147) 评论(0) 推荐(0) 编辑
摘要: 划分树 + 二分二分枚举第k小的数与h比较大小。#include <stdio.h>#include <string.h>#include <stdlib.h>#include <algorithm>using namespace std;const int MAXN = 100100;struct Node{ int l, r;}T[MAXN << 2];int d[MAXN], s[MAXN], t[35][MAXN], tol[35][MAXN];void build(int level, int rt, int l, int 阅读全文
posted @ 2012-09-23 17:20 找回失去的 阅读(1101) 评论(0) 推荐(0) 编辑
摘要: 求次短路径。先求出从1出发的单源最短路,用d[0][i]表示,再求出从N出发的单源最短路,用d[1][i]表示。次短路应该是在d[0][a]+ d[1][b]+w[a][b]中选,先用heap+Dijktra做两遍最短路,然后再求次短路即可。/*Accepted 2792K 110MS C++ 2128B 2012-09-22 10:29:43*/#include <stdio.h>#include <string.h>#include <stdlib.h>#include <algorithm>#include <queue>usi 阅读全文
posted @ 2012-09-22 10:31 找回失去的 阅读(681) 评论(0) 推荐(0) 编辑
摘要: 最优比例生成树,用prim解生成树的权值之和,然后用迭代法求最优比例,也可以用二分法来求比例。lowc[i]=dh[1][i]-x*dl[1][i],高度差-平面距离*比例。/*Accepted 16292K 188MS C++ 1936B 2012-09-22 10:12:11*/#include <stdio.h>#include <string.h>#include <stdlib.h>#include <queue>#include <algorithm>#include <math.h>using namespa 阅读全文
posted @ 2012-09-22 10:26 找回失去的 阅读(199) 评论(0) 推荐(0) 编辑
摘要: 贪心,以时间点i开始的活动数目为beg[i],结束的记为end[i],然后每扫到一个开始和结束,数组都计数。然后统计一天同一个时间点有多少个开始就行了,遇到结束要减去。最小的天数就求出来了。/*Accepted 3650 15MS 916K 881 B C++ Yu*/#include <stdio.h>#include <string.h>#include <stdlib.h>#include <algorithm>using namespace std;const int MAXN = 24 * 3600;int beg[MAXN + 10] 阅读全文
posted @ 2012-09-17 15:28 找回失去的 阅读(208) 评论(0) 推荐(0) 编辑
摘要: 让上面的w和s都尽可能小,即w+s升序排序,值小的放在上面。这样一来,不管是w很大s很小或者s很大w很小,都可以使得最大的PDV尽可能地小,可以用笔写写看。#include <stdio.h>#include <string.h>#include <stdlib.h>#include <algorithm>using namespace std;typedef __int64 LL;const int MAXN = 100100;int n;struct Node{ LL w, s;}t[MAXN];bool cmp(const Node a, 阅读全文
posted @ 2012-09-16 17:35 找回失去的 阅读(1262) 评论(0) 推荐(0) 编辑
摘要: 枚举 + 二分,代码写得挫!#include <stdio.h>#include <string.h>#include <stdlib.h>#include <math.h>typedef __int64 LL;LL x, y, z, D, S;LL k;int main(){ int i, j; while(scanf("%I64d", &k), k) { S = 0; for(D = 1; D < k / 2; D <<= 1, S ++); bool flag1, flag2; LL a, b, 阅读全文
posted @ 2012-09-15 11:06 找回失去的 阅读(230) 评论(0) 推荐(0) 编辑
摘要: 求s到e经过n条边的最短路,看了08年国家集训队.俞华程的论文《矩阵乘法在信息学中的应用》,其中讲到图的邻接矩阵k次方后,a[i][j]可以表示i到j经过n-1个点的一条路径,结合floyd就能求出我们所需要的结果。/*Accepted 2060K 172MS C++ 1608B 2012-09-15 10:38:47*/#include <stdio.h>#include <string.h>#include <stdlib.h>const int MAXN = 1 << 10;const int MAXD = 105;int hash[MAX 阅读全文
posted @ 2012-09-15 10:52 找回失去的 阅读(237) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 ··· 29 下一页