- 博客(31)
- 收藏
- 关注
原创 HDU - 6166 SPFA最短路次短路 or 二进制+Dijstra
题目传送门:http://acm.hdu.edu.cn/showproblem.php?pid=6166题意:给一个有向图,给一个集合,从集合内任选两个点的最短路最短为多少。分析:两种解法,一种是题解中给的,感觉非常巧妙,把集合分为两个集合,改成多源多汇最短路,如何保证任意一对点都分在过不同的集合呢,就是使用二进制,对于每一二进制位,二进制表示下不同的就分在不同的集合,因为对于每一对数,至
2017-08-23 15:52:33
281
原创 HDU - 4567 Brilliant Programmers Show 2013长沙邀请赛
题目传送门:http://acm.hdu.edu.cn/showproblem.php?pid=4567写在前面:这道题题目数据有问题,第40组以后的数据没有任何输出,也不知道是哪位大神发现的,反正就是这样...题意:有一队人,相邻的两个人中排名靠后的可以向排名靠前的挑战,如果挑战成功,他们排名互换,现在已知初始各排名的人发起挑战的次数,问你是否合理,如果合理能否确定冠军
2017-05-30 16:49:24
459
原创 HDU - 4570 Multi-bit Trie 2013长沙邀请赛
题目传送门:http://acm.hdu.edu.cn/showproblem.php?pid=4570题意:题目花了一个乱糟糟的图,然后给了一对乱糟糟的文字,然后抽象出数学模型就是这样的,给你一串数,你可以把它分割成无数段,每一段的权值为该段的第一个数乘上2^该段的长度,问你所有段的权值和最小为多少。分析:这道题难就难在题意分析上了,题意看明白了,DP随便搞搞就能过了,特
2017-05-30 16:32:44
260
原创 HDU - 4568 Hunter 2013长沙邀请赛
题目传送门:http://acm.hdu.edu.cn/showproblem.php?pid=4568题意:给你一个四联通的长方形,每一个格子中都有一个值,你走到这个格子要耗费这些体力,-1代表无法通过,其中有一些格子里面有宝藏,一个人可以从边界的任意一个点进入,边界的任意一个点出去,问如果他得到了所有的宝藏,耗费的体力最少是多少。分析:总共有40000个格子,对这400
2017-05-30 16:28:35
378
原创 HDU - 4571 Travel in time 2013长沙邀请赛
题目传送门:http://acm.hdu.edu.cn/showproblem.php?pid=4571题意:有n个景点,m条双向路,给出参观每个景点所需时间和获得的价值,给出走过每条路所需时间,给出起点和终点,你可以路过某个景点而不参观,但是你当前参观的景点必须要比之前参观过的景点价值要大,给出起点终点和规定的时间,问你能否在规定的时间内由起点走到终点,可以的话获得的最大价值是多少。分析
2017-05-30 16:19:08
321
原创 Codeforces Gym 100623I Problem I. Important Wires
题目传送门:http://codeforces.com/gym/100623/attachments题解:这道题...说了一大堆没用的....如果你看了题不会做再看代码...你会大喊我去....Code:#include #include #include using namespace std;int main(){ freopen("impor
2017-04-01 11:16:37
299
原创 Codeforces Gym 100623J Problem J. Just Too Lucky 数位DP
题目传送门:http://codeforces.com/gym/100623/attachments题解:数位DP经典题目,先暴力一遍,把可能出现的各位数字和都跑一遍,然后就是经典数位DP了,记忆化搜索写完的,详见代码Code:#include #include #include using namespace std;long long n,dp[15][
2017-04-01 10:21:01
481
原创 Codeforces Gym 100623F Problem F. Fenwick Tree
题目传送门:http://codeforces.com/gym/100623/attachments题解:一个找规律的题,b[2]=a[2]要求a[1]=0,b[4]=a[4]要求a[2]+a[3]=0,b[6]=a[6]要求a[5]=0,b[8]=a[8]要求a[4]+a[6]+a[7]=0,到这里就可以看出来规律了,一个偶数可以对2^n取余为0,则要求他前面的n个数和为0,这个n个
2017-03-31 13:55:52
503
原创 Codeforces Gym 100623B Problem B. Billboard
题目传送门:http://codeforces.com/gym/100623/attachments题解:这道题吧,队友做的,听他说是线段树基础题...Code:#include using namespace std;#define ls l,mid,rt*2#define rs mid+1,r,rt*2+1#define mi (l+r)>>1const
2017-03-31 10:56:54
520
原创 Codeforces Gym 100623K Problem K. Key to Success
题目传送门:http://codeforces.com/gym/100623/attachments题解:这道题,就相当于给你n个硬币,问你能组成多少钱,我们就从头开始计数,首先必须要有一个1,然后我们就从头开始加,如果sum小于下一个数-1,那么这中间的数就拼不出来了,我们就要放一个sum+1上去,这样一直跑下去,放完为止,看代码吧,很简单Code:#include
2017-03-31 10:53:30
555
原创 Codeforces Gym 100623H Problem H. Holes
题目传送门:http://codeforces.com/gym/100623/attachments题解:额...这道题不能再简单了...输入1输出0,输入0输出1,输入其他的奇数先来个4,然后/2,输出那么多个8Code:#include #include using namespace std;int main(){ freopen("holes
2017-03-31 10:50:13
502
原创 Codeforces Gym 100623E Problem E. Enchanted Mirror
题目传送门:http://codeforces.com/gym/100623/attachments题解:一道暴力的题...先把第一个字符串换成正确的字符串,如果换不了就直接输出No,刚开始没注意到这里,错了第6组,换的时候第二个字符串也对应交换,然后一个字符串里重复的字母可以互换位置,对应第二个字符串里的位置也可以互换,看一下能不能换成第二个目标字符串Code:#in
2017-03-31 10:47:59
546
原创 Codeforces Gym 100623D Problem D. Deposits
题目传送门:http://codeforces.com/gym/100623/attachments题解:暴力解决...先把第一组的数数量存起来,然后第二组数开始遍历10^6之内他的整数倍的数,然后把数量加起来,用了个小技巧,就是第二组数里如果找过了直接加,算了一下,总共最多跑10^7次,不会超时Code:#include #include #include #i
2017-03-31 10:44:42
586
原创 Codeforces Gym 100623C Problem C. Class
题目传送门:http://codeforces.com/gym/100623/attachments思路:一道比较简单的思维题吧,要求任一横行学生和任一纵列学生的最小值最大,如果学生人数大于行数和列数最小值*2-1,就输出行数和列数最小值,否则输出(人数+1)/2,很好理解,剩下的学生随便排就行Code:#include #include using namesp
2017-03-31 10:30:10
382
原创 HDU 3448 Bag Problem 暴力枚举,DFS(maybe)
来找博客的估计应该都看过题,所以以后的博客在这里都不贴题了,直接放一个传送门,想看题的点击去看这里是传送门这道题是我们背包的一道训练题,这道题我用了两种解法来解第一种解法是我刚开始想的暴力枚举,代码很易懂,先把0存起来,然后把第一个数和存过的数每个相加,都存起来,然后在把第二个数和之前的数依次相加,不过这样的话要存的数可能有2^40这么多,很显然存不下,所以我们可以用一些方
2016-11-09 08:30:16
373
原创 UVA 10635 Prince and Princess 递推
uva的题就不粘题目了 传送门:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1576这道题先把第一组数据编上号,然后第二组数据对上第一组的号,在第一组没出现的就不用管了,因为第一个人跳不到那,然后求一下最长上升子序列,第一次我是用暴力搜的,
2016-10-30 16:36:18
312
原创 POJ 3186 Treats for the Cows 递推
Treats for the CowsTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 5234 Accepted: 2737DescriptionFJ has purchased N (1 The treats are interesting fo
2016-10-30 16:35:08
193
原创 HDU 2859 Phalanx 递推
PhalanxTime Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1261 Accepted Submission(s): 625Problem DescriptionToday is army day,
2016-10-30 16:30:43
222
原创 HDU 5119 Happy Matt Friends 递推
Happy Matt FriendsTime Limit: 6000/6000 MS (Java/Others) Memory Limit: 510000/510000 K (Java/Others)Total Submission(s): 3294 Accepted Submission(s): 1285Problem DescriptionMatt
2016-10-30 16:25:21
299
原创 HDU 1160 FatMouse's Speed 递推
FatMouse's SpeedTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 14864 Accepted Submission(s): 6549Special JudgeProblem Descriptio
2016-10-30 16:21:05
201
原创 HDU 1503 Advanced Fruits 递推
Advanced FruitsTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 3091 Accepted Submission(s): 1590Special JudgeProblem Description
2016-10-30 16:16:16
204
原创 UVA 10328 Coin Toss 递推
UVA的题目就不贴题目了,题目传送门:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1269这道题是我第一组递归题里面想的时间第二长的,第一长的是一个简单题,好尴尬...然后这道题还运用到了大数,奈何我没学会java只能套了一个大数模板了
2016-10-30 15:51:56
636
原创 HDU 5642 King's Order 递推
King's OrderTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 829 Accepted Submission(s): 454Problem DescriptionAfter the king'
2016-10-30 15:50:50
291
原创 POJ 2385 Apple Catching 递推
Apple CatchingTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 11546 Accepted: 5565DescriptionIt is a little known fact that cows love apples. Farmer Joh
2016-10-30 15:46:50
457
原创 HDU 5092 Seam Carving 递推
Seam CarvingTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1353 Accepted Submission(s): 532Problem DescriptionFish likes to
2016-10-30 15:42:12
417
原创 HDU 1078 FatMouse and Cheese 递推
FatMouse and CheeseTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 8737 Accepted Submission(s): 3665Problem DescriptionFatMou
2016-10-30 15:38:00
237
原创 CodeForces 429B Working out 递推
B. Working outtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputSummer is coming! It's time for Iahub and Ia
2016-10-30 15:34:44
308
原创 CodeForces 550E Brackets in Implications 也是找找规律差不多...
E. Brackets in Implicationstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputImplication is a function of tw
2016-10-30 15:29:13
391
原创 CodeForces 550C Divisibility by Eight 简单题算是找规律?
C. Divisibility by Eighttime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a non-negative integ
2016-10-30 15:24:58
277
原创 CodeForces 550B Preparing Olympiad 简单DFS
B. Preparing Olympiadtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou have n problems. You have estimat
2016-10-30 15:20:17
249
原创 CodeForces 550A Two Substrings 简单题
A. Two Substringstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given string s. Your task is to d
2016-10-30 15:14:54
589
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人