- 博客(8)
- 收藏
- 关注
原创 zoj2913 Bus Pass BFS
ZOJ - 2913 Bus Pass Time Limit: 5000MS Memory Limit: 32768KB 64bit IO Format: %lld & %llu Submit Status Description You travel a lot by bus and the costs of al
2015-11-18 21:12:52
382
原创 poj3928 树状数组应用
Ping pong Time Limit:1000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u Submit Status Practice POJ 3928 Description N(3<=N<=20000) ping pong players live along a west-
2015-11-14 14:08:58
579
原创 ZOJ2972-Hurdles of 110m
dp[i][j],跨过i个栏,用了j点体力时的最小时间 dp[0][j]=0 #include #include #include #include using namespace std; #define INF 0x3f3f3f3f int main() { #ifdef TEST freopen("in.in","r",stdin); #endif int t,n,m; int t
2015-11-07 21:04:45
366
原创 ZOJ2975 Kinds of Fuwas
枚举 i 列和 j 列,统计(第 k 行 i 列) 和 (第 k 行 j 列) 相等的数目,再用组合公式算出符合的矩形的个数 #include #include int fun(char c) { if(c=='B') return 0; if(c=='J') return 1; if(c=='H') return 2; if(c=='Y') return 3; return
2015-11-07 18:50:46
278
原创 hud5524 Subtrees 二叉树中不同节点数的字数个个数
用set储存子数的节点数,set中元素的数目及为结果 #include #include #include using namespace std; set s; long long a[65];//每层节点的个数 void dfs(long long n,int D)//n为当前节点数,D为当前层数 { if(D==0 || n==0 || s.count(n)) return; s.in
2015-11-06 21:55:42
279
转载 fzu2202犯罪嫌疑人 逻辑判断
假设i是犯人,则说真话的人数m=说i是犯人的人数+(说某人不是犯人的人数-说i不是犯人的人数) 若i说x是犯人,x可能是犯人时,i说的可能是真话也可能是假话;x不可能是犯人时,i说的必为假话 若i说x不是犯人,x可能是犯人时,i说的可能是真话也可能是假话;x不可能是犯人时,i说的必为真话 #include #include #include using namespace std;
2015-10-09 23:54:57
426
原创 uva 839 Not so Mobile
我的代码:#include #include using namespace std; int fun(int W,int D) { int a,b,c,d,x,y; if(W==0) { scanf("%d%d%d%d",&a,&b,&c,&d); x=fun(a,b); //左边的质量 y=fun(c,d); //右边的质量 if(x*b==y*d) return
2015-05-14 21:11:39
179
转载 poj2255已知前序排列和中序排列求后序排列
http://poj.org/problem?id=2255 题意:给定一棵二叉树的先序遍历结点序列和中序遍历结点序列,求其后序遍历结点序列。树的结点不超过26。 分析:由于遍历都是递归定义的,所以不难得到以下结论:树的任意子树的遍历结点序列一定是该树的遍历结点序列的一个连续子序列。有了这个结论后,我们的任务就是确定子树遍历结点序列的起点和终点,而这个可以根据preorder和in
2015-05-14 13:56:25
713
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人