- 博客(21)
- 收藏
- 关注
原创 Codeforces-713C-Sonya and Problem Wihtout a Legend
题目链接:http://codeforces.com/problemset/problem/713/C题意:给定一个正整数序列,每次可以选择一个数,增加或者减少一,问最少执行多少次操作能把原序列变成严格递增序列?思路:如果这是要求非严格递增序列即严格不下降序列的话,这就是一个很经典的题目,关于这个题目还有一个定理: ·不严格递减最后修改完之后的各个数一定是原序列中的某个数! 这样的话既可以考虑用
2017-07-21 19:12:16
475
原创 BZOJ-1898 Swamp 沼泽鳄鱼
题目链接:http://www.lydsy.com/JudgeOnline/problem.php?id=1898思路 : 因为是中文题,题意就不过多描述了。食人鱼的活动周期分别是2、3或4,这样可以考虑所有的食人鱼的活动情况一定是最小以12为周期的,这样我们就构造12个矩阵,a[ i ].m[ x ][ y ]每个矩阵表示在第 i 时刻,从第 x 个石墩到第 y 个石墩能不能走,这样将这十二个矩阵
2017-07-20 11:38:55
376
原创 ZOJ-2317 Nice Patterns Strike Back
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2317题意:给一个N*M的矩阵,填黑、白两种颜色,问其中不能有2*2的矩阵是一样颜色的方案数?方案数太大,输出%p之后的结果。思路:N<10^100,M<=5,一看数据范围就能猜到是在M上研究。因为M非常小,所以我们可以枚举每一列的状态,总共只有2^5=32中状态,这
2017-07-20 11:28:42
377
原创 Array Division
C. Array Division time limit per test:2 seconds memory limit per test:256 megabytes inputstandard: input
2017-07-11 15:17:08
608
原创 Friends and Subsequences
B. Friends and Subsequences time limit per test:2 seconds memory limit per test:512 megabytes inputstandard
2017-07-11 15:06:08
386
原创 Mike and Cellphone
A. Mike and Cellphone time limit per test1 second memory limit per test256 megabytes inputstandard input
2017-07-11 14:56:46
334
原创 Enormous Carpet
Enormous Carpet Ameer is an upcoming and pretty talented problem solver who loves to solve problems using computers. Lately, He bought a very very very large square carpet that has an enormous area, s
2017-04-06 21:47:33
498
原创 OCR
OCR Optical Character Recognition (OCR) is one of the most famous fields of Artificial Intelligence. The main purpose of OCR is to recognize printed text (or handwriting) and convert it to the machine
2017-04-06 20:52:46
389
原创 Weird Cryptography
Weird Cryptography Khaled was sitting in the garden under an apple tree, suddenly! , well… you should guess what happened, an apple fell on his head! , so he came up with a new Cryptography method!! T
2017-04-01 21:11:16
384
原创 Time
Time A plane can go from city X to city Y in 1 hour and 20 minutes. However, when it returns from city Y to city X, with the same speed, it spends only 80 minutes! If you don’t know how might that hap
2017-04-01 20:49:58
290
原创 Boredom
Boredom Alex doesn’t like boredom. That’s why whenever he gets bored, he comes up with games. One long winter evening he came up with a game and decided to play it.Given a sequence a consisting of n i
2017-03-12 23:41:37
699
原创 Slim Span
Slim Span 题目大意:给定N个点,M条边,问它的生成树中权值最大的边和权值最小的边的差值最小是多少?思路:Dijkstra.将M条边排序,然后求最小生成树,然后把(1)这条边去掉,再做最小生成树,然后把(2)这条边去掉……这样比较每次求出的差值取最小值就可以(注意边的数量不能少于n-1)。这里要注意:去掉若干条边之后,可能就没有生成树了,这里一定要注意判断!code:#incl
2017-03-12 23:32:35
549
原创 Connect the Campus
Connect the Campus 题目大意:给定n个点的坐标,其中m个点已经连接,问把所有点都连接的最小花费?思路:并查集–Dijkstra,已经连接的就初始化为一个连通块里,然后再跑一边最小生成树就可以了。code:#include<iostream>#include<cstdio>#include<cstring>#include<algorithm>#include<cma
2017-03-12 23:23:39
384
原创 ACM Contest and Blackout
ACM Contest and Blackout In order to prepare the “The First National ACM School Contest” (in 20??) the major of the city decided to provide all the schools with a reliable source of power. (The major
2017-03-12 23:15:45
490
原创 tree
A - tree 给你一个无向带权连通图,每条边是黑色或白色。让你求一棵最小权的恰好有need条白色边的生成树。 题目保证有解。Input 第一行V,E,need分别表示点数,边数和需要的白色边数。 接下来E行,每行s,t,c,col表示这边的端点(点从0开始标号),边权,颜色(0白色1黑色)。Output 一行表示所求生成树的边权和。 V<=50000,E<=100000,所有数据边权
2017-03-12 23:06:17
466
原创 Wormholes
Wormholes While exploring his many farms, Farmer John has discovered a number of amazing wormholes. A wormhole is very peculiar because it is a one-way path that delivers you to its destination at a t
2017-03-05 00:46:11
275
原创 Arbitrage
ArbitrageArbitrage is the use of discrepancies in currency exchange rates to transform one unit of a currency into more than one unit of the same currency. For example, suppose that 1 US Dollar buys 0
2017-03-05 00:39:10
274
原创 In Action
In Action Since 1945, when the first nuclear bomb was exploded by the Manhattan Project team in the US, the number of nuclear weapons have soared across the globe. Nowadays,the crazy boy in FZU name
2017-03-05 00:34:46
397
原创 A strange lift
A strange liftThere is a strange lift.The lift can stop can at every floor as you want, and there is a number Ki(0 <= Ki <= N) on every floor.The lift have just two buttons: up and down.When you at fl
2017-03-05 00:23:50
472
原创 Parallelogram is Back
CodeForces - 749B Long time ago Alex created an interesting problem about parallelogram. The input data for this problem contained four integer points on the Cartesian plane, that defined the set of v
2017-02-23 22:51:15
370
原创 Bachgold Problem
CodeForces - 749ABachgold problem is very easy to formulate. Given a positive integer n represent it as a sum of maximum possible number of prime numbers. One can prove that such representation ex
2017-02-23 21:03:35
411
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人