- 博客(46)
- 收藏
- 关注
原创 2016团体程序设计天梯赛CCCC 决赛总结
CCCC总结 周六能够参加CCCC决赛感到很幸运,又发衣服,又合影的,很高兴,但是比赛打的并不理想,现在总结反思一下: 成绩情况是做出了第一阶段的题目和第三阶段完全二叉树的一部分分,总共是143分,很低很低,和自己预想的差很多。 第二阶段做不出题目的原因很大一部分在于第一阶段的影响,第一阶段的题目都不是算法题目,想一想随便写写就可以过,但就是这些题目,有一部分题目卡了自己很久很久
2016-07-18 11:05:38 1516 1
原创 HDU 3366 Passage (概率DP)
PassageTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 465 Accepted Submission(s): 218Problem DescriptionBill is a millionaire. B
2016-07-29 22:12:43 485
原创 POJ 3168 Barn Expansion (平面扫描)
Barn ExpansionTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 2305 Accepted: 607DescriptionFarmer John has N (1 <= N <= 25,000) rectangular barns on his f
2016-07-29 02:54:14 440
原创 POJ 3172 Scales (01背包 DFS)
ScalesTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 2665 Accepted: 703DescriptionFarmer John has a balance for weighing the cows. He also has a set of N
2016-07-28 20:39:55 518
原创 POJ 3170 Knights of Ni (双向BFS打表记录)
Knights of NiTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 2032 Accepted: 872DescriptionBessie is in Camelot and has encountered a sticky situation: she
2016-07-28 18:30:53 632
原创 POJ 3175 Finding Bovine Roots (枚举)
Finding Bovine RootsTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 4374 Accepted: 876DescriptionThe cows are trying to find their roots. They are not so
2016-07-28 18:20:47 452
原创 HDU 4588 Count The Carries (数学-- 二进制技巧枚举)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4588大体题意:给你两个十进制数字a和b ,求得二进制数从a 加加 一直加到b 总共二进制进位多少?思路:比赛时没有做出来,请教的同学:不过思路的确很巧妙:既然是求和,那么我们不妨先把这些数摆出来看看规律:0 00001 00012 00103
2016-07-28 11:12:06 439
原创 Codeforces Round #298 (Div. 2) -- Polycarpus' Dice (数学推理)
Polycarpus' Dicetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputPolycarp has n dice d1, d2, ..., dn. The
2016-07-25 12:25:56 293
原创 Codeforces Round #301 (Div. 2) -- D. Bad Luck Island (概率DP)
D. Bad Luck Islandtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe Bad Luck Island is inhabited by thre
2016-07-25 10:50:08 385
原创 Codeforces Round #245 (Div. 1) -- B. Working out (DP)
B. Working outtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputSummer is coming! It's time for Iahub and Ia
2016-07-24 18:13:50 474
原创 Codeforces Beta Round #95 (Div. 2) -- D. Subway (DFS)
D. Subwaytime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputA subway scheme, classic for all Berland cities is represen
2016-07-17 11:42:41 452
原创 Codeforces Beta Round #95 (Div. 2) -- F. Present to Mom(技巧枚举)
F. Present to Momtime limit per test5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputHow many stars are there in the sky? A young progra
2016-07-17 11:32:45 455
原创 Codeforces Beta Round #95 (Div. 2) -- E. Yet Another Task with Queens(STL)
E. Yet Another Task with Queenstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputA queen is the strongest chess piece.
2016-07-17 11:23:27 714
原创 团体程序设计天梯赛-练习集 -- L2-014. 列车调度(线段树)
L2-014. 列车调度时间限制 300 ms内存限制 65536 kB代码长度限制 8000 B判题程序 Standard 作者 陈越火车站的列车调度铁轨的结构如下图所示。Figure两端分别是一条入口(Entrance)轨道和一条出口(Exit)轨道,它们之间有N条平行的轨道。每
2016-07-17 00:14:09 2203
原创 团体程序设计天梯赛-练习集 -- L3-010. 是否完全二叉搜索树
L3-010. 是否完全二叉搜索树时间限制 400 ms内存限制 65536 kB代码长度限制 8000 B判题程序 Standard 作者 陈越将一系列给定数字顺序插入一个初始为空的二叉搜索树(定义为左子树键值大,右子树键值小),你需要判断最后的树是否一棵完全二叉树,并且给出其层序遍历的结果。
2016-07-16 21:17:24 751
原创 HDU 1754 I Hate It (线段树 -- 单点替换,区间最值)
I Hate ItTime Limit: 9000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 62499 Accepted Submission(s): 24268Problem Description很多学校流行一种比较的习惯。老师们很
2016-07-13 01:10:01 320
原创 UVA - 11995 I Can Guess the Data Structure! 猜猜数据结构(STL模拟)
大体题意:有两种操作 1 x 把 x 放到集合里。2 x 在x中取出的第一个元素是x问这个集合是优先队列还是普通队列 还是栈。还是不能确定 还是不可能!思路:直接拿着三个东西模拟一下即可!比较简单 具体不多说了,详细见代码:#include#include#include#include#includeusing namespace std;prior
2016-07-10 14:57:42 749
原创 UVA - 1329 Corporative Network 合作网络(并查集)
大体题意:有n 个结点,初始时每个结点的父节点都不存在。你的任务是执行一次I操作和E操作,格式如下:I u,v 把结点u 的父节点设置为v,距离为|u-v|%1000 保证u没有父节点。E u,询问u到根节点的距离!思路:并查集:用d[u]表示u结点到根节点的距离。每次E操作都初始化父节点和 距离!每次I操作 都要查一下父节点,find,在find过程中更新d数
2016-07-10 14:31:25 399
原创 UVA - 11235 Frequent values 频繁出现的数值(RMQ)
大体题意:给你n 个元素的非降序排列的数组,给你m 个询问i,j,求出 区间[i,j]内出现次数最多数的次数!思路:RMQ算法是求某个区间内的最小值或最大值!这个问题关键是转换到RMQ问题上去!因为数组呈非降序,所以所有相等的元素会聚在一起!所以可以把数组分成一块一块的, val[i]表示第i块 数值是多少,cot[i]表示第i块出现了多少次!num[p]表示数组位置p
2016-07-10 13:18:06 574
原创 UVA 1428 || LA 4329 PingPang (树状数组)
大体题意:街道上住着n 个 人,每个人都喜欢打乒乓球,他们之间会互相切磋,那组织一场乒乓球比赛需要三个人,一个裁判,两个运动员,要求裁判的能力值要介于两个运动员之间,并且位置也在他们之间,问最后有多少种选法?思路:输入完n 个数后,统计 在a[i]左边比a[i]小的个数 有sml[i]个,那么大的就有i-1-sml[i]个,在统计右边比a[i]小的个数 smr[i]个,那么大的个数就
2016-07-10 00:55:07 444
原创 Codeforces Round #357 (Div. 2) -- D. Gifts by the List(DFS)
D. Gifts by the Listtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputSasha lives in a big happy family. At the Man's D
2016-07-09 16:18:50 578
原创 Codeforces Round #357 (Div. 2) -- C. Heap Operations (优先队列模拟)
C. Heap Operationstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputPetya has recently learned data structure named "Bi
2016-07-09 12:42:47 427
原创 Codeforces Round #358 (Div. 2) -- D. Alyona and Strings (DP)
D. Alyona and Stringstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAfter returned from forest, Alyona started read
2016-07-09 12:29:42 366
原创 Codeforces Round #197 (Div. 2) -- D. Xenia and Bit Operations(线段树)
D. Xenia and Bit Operationstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputXenia the beginner programmer has a seque
2016-07-08 16:33:42 554
原创 Codeforces Round #197 (Div. 2) -- C. Xenia and Weights (DFS回溯)
C. Xenia and Weightstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputXenia has a set of weights and pan scales. Each
2016-07-08 15:53:29 450
原创 Codeforces Round #199 (Div. 2) -- C. Cupboard and Balloons (数学)
C. Cupboard and Balloonstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputA girl named Xenia has a cupboard that looks
2016-07-08 15:41:39 411
原创 Codeforces Round #199 (Div. 2) -- B. Xenia and Spies (简单模拟)
B. Xenia and Spiestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputXenia the vigorous detective faced n (n ≥ 2) fore
2016-07-08 15:35:20 448
原创 Codeforces Round #199 (Div. 2) -- A. Xenia and Divisors (思路)
A. Xenia and Divisorstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputXenia the mathematician has a sequence consistin
2016-07-08 15:27:24 370
原创 Codeforces Round #293 (Div. 2) -- A. Vitaly and Strings (字符串构造)
A. Vitaly and Stringstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputVitaly is a diligent student who never missed a
2016-07-07 15:13:44 676
原创 Codeforces Round #293 (Div. 2) -- E. Arthur and Questions (思路 + 贪心)
E. Arthur and Questionstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAfter bracket sequences Arthur took up number
2016-07-07 14:59:53 475
原创 Codeforces Round #293 (Div. 2) -- D. Ilya and Escalator(概率DP)
D. Ilya and Escalatortime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputIlya got tired of sports programming, left univ
2016-07-07 10:18:32 371
原创 Codeforces Round #361 (Div. 2) -- A. Mike and Cellphone (思路题目)
A. Mike and Cellphonetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputWhile swimming at the beach, Mike has accidental
2016-07-07 09:42:08 530
原创 Codeforces Round #358 (Div. 2) -- C. Alyona and the Tree (树上的DFS)
C. Alyona and the Treetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAlyona decided to go on a diet and we
2016-07-06 16:32:45 409
原创 Codeforces Round #358 (Div. 2) -- B. Alyona and Mex (思路水题)
B. Alyona and Mextime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputSomeone gave Alyona an array containing n positive i
2016-07-06 15:19:59 670
原创 Codeforces Round #358 (Div. 2) -- A. Alyona and Numbers(暴力水题)
A. Alyona and Numberstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAfter finishing eating her bun, Alyona came up w
2016-07-06 14:59:34 459
原创 例题9-3 UVA - 1347 Tour 旅行(DP)
大体题意:给你n 个点 已经按照x坐标排了序,问从左边的点一条线的走到右边的点并且一条线的返回起点,除了起点和终点外其余的点各走一次!思路:令dp[i][j]表示1~ max(i,j)都走过了,并且第一个人在i位置,第二个人在j位置,假设i > j。那么1,2,3,,,,i位置都是走过的,第一个人可以走到i + 1,第二个人不动, 或者第二个人走到i+1,第一个人不动。那么转
2016-07-06 11:48:44 493
原创 Codeforces Round #360 (Div. 2) -- E. The Values You Can Make (DP)
E. The Values You Can Maketime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputPari wants to buy an expensive chocolate f
2016-07-06 01:22:00 840
原创 例题10-13 UVA - 580 Critical Mass 危险的组合(递推)
题意不说了,题意很简单!思路:看了书上的分析,感觉有增进了不少= = !注:文中出现的POW(n)都是2的n次方的意思!排列是按照最先出现连续的U的最左边位置枚举的!假定最先出现的连续的U 是从位置i 开始的,那么i,i+1,i+2一定是U ,后面连续不连续不一定了,可能连续也可能不连续!那么前i-1个位置必然不会出现连续的3个U,假定f(n)表示有n 个箱子时的答
2016-07-05 16:36:37 672
原创 例题10-10 UVA - 10491 Cows and Cars 奶牛与轿车 (全概率)
题意不说了.思路:完全按照书上分析来做的!记录一下吧。假设有a头牛,b个轿车,给你展示c个门。那么情况一:一开始选择了牛,概率为a/(a+b),还有a+b-c-1个门可以换,轿车还有b个, 则P1 = a/(a+b) * b/(a+b-c-1);情况二:一开始选择了车,概率为b/(a+b),还有a+b-c-1个门可以换,轿车还有b-1个,则P2 = b/(a+b) *
2016-07-05 15:17:57 547
原创 例题8-12 UVA - 12627 Erratic Expansion 奇怪的气球膨胀 (递归)
大体题意不说了 书上画的很清楚= = !思路:令f(k,i)表示第k 小时后,从上面数i 行 红气球的个数,那么答案就是 f(k,b) - f (k,a-1);通过看图不难发现:如果i >= pow2(k-1) 那么 f (k,i) = 2 * C(k-1) + f (k-1, i - pow2( k-1 ) );否则 f(k,i) = 2 * f (k-1,i);其中C
2016-07-05 11:22:57 399
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人