- 博客(30)
- 资源 (1)
- 收藏
- 关注
原创 hdu 4393Throw nails(优先队列)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4393题目大意:有n个人参加比赛,他们在第一秒内跑了Fi米,在之后的时间他们的速度为Si米/秒,每一秒淘汰距离起点最远的人,求淘汰人的顺序。题目思路:容易想到是优先队列,但是要考虑每次怎么更新新的距离。由于Si的范围很小,定义一个优先队列的数组,我可以把Si相同的人放入同一个优先队列内,按照Fi...
2018-12-17 12:38:00
371
原创 poj1606 Jugs(BFS)
题目链接:http://poj.org/problem?id=1606题目大意:有A,B两个水壶和无限的水,可以通过6种操作使得B水壶的水量刚好为N,输出满足题意的任意一种操作顺序。六种操作:①把A水壶加满②把B水壶加满③把A水壶的水全部倒掉④把B水壶的水全部倒掉⑤把A水壶里的水全部倒入B水壶中,溢出的水留在A水壶内⑥把B水壶里的水全部倒入B水壶中,溢出的水留在B水...
2018-12-10 11:31:25
263
原创 hdu 1576 A/B(乘法逆元)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1576题目思路: 求(A/B)%9973,等于是求B的逆元乘上n.求数的逆元可以用欧几里得算法求逆元。又因为9973是素数满足费马小定理,即,所以b的逆元,使用快速幂即可求得。欧几里得代码:#include <cstdio>using namespace std;t...
2018-12-03 12:30:53
226
原创 hdu 1072 Nightmare(BFS)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1072题目大意:逃出迷宫,有6秒的时间限制,但是可以通过到达4点来重置时间回到6秒,求最短时间。不能逃出输出-1.题目思路:算最短时间,用宽度优先搜索,由于4点可以重复到达,因此不能直接标记所有走过的点。但是重复到达4点是没有意义的,所以每个位置的4点最多经过1次,走过之后把它标记为墙就行了,不...
2018-11-26 11:26:54
173
原创 hdu 1069 Monkey and Banana(LIS)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1069题目大意:提供了n种砖,有长、宽、高的属性,尽可能的把砖叠高,满足上面的砖宽和长严格的小于下面的砖。求最高的高度。解题思路:和求最长上升子序列的长度是一样的,只不过多了一个长或则宽的限制条件。首先将题目给的砖的所有种类进行从小到大排序(长为第一关键字,宽为第二关键字),。求这些砖能够叠多高...
2018-11-18 19:37:10
167
原创 ZOJ 4060 Flippy Sequence(思维)
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=4060题目大意:有两个只包含0和1字符串,,通过将字符串1区间内的0和1反转2次(0反转为1,1反转为0),求方案数。思路:反转的顺序不会影响最后的结果。为了方便分析,我将所有的字符串2都看作是0组成的,字符串1内的1就是需要我们反转的,分析以下情况。(...
2018-11-11 20:37:17
454
原创 hdu Hakase and Nano (博弈)
Problem C. Hakase and NanoHakase and Nano are playing an ancient pebble game (pebble is a kind of rock). There are n packs of pebbles, and the i-th pack contains ai pebbles. They take turns to pick ...
2018-10-22 11:23:33
263
原创 hdu 6273 Master of GCD (线段树+区间更新)
Problem J. Master of GCDHakase has n numbers in a line. At first, they are all equal to 1. Besides, Hakase is interested in primes. She will choose a continuous subsequence [l,r] and a prime paramete...
2018-10-14 15:33:21
416
原创 ZOJ 3987 Numbers (BigInteger类、贪心)
NumbersTime Limit: 2 Seconds Memory Limit: 65536 KBDreamGrid has a nonnegative integer . He would like to divide into nonnegative integers and minimizes their bitwise or (i.e. and should ...
2018-10-13 19:54:25
345
原创 ZOJ - 3983 Crusaders Quest(思维)
ZOJ Problem Set - 3983Crusaders QuestTime Limit: 1 Second Memory Limit: 65536 KBCrusaders Quest is an interesting mobile game. A mysterious witch has brought great darkness to the game worl...
2018-10-11 20:02:53
300
原创 hdu 5983 Pocket Cube(模拟)
Pocket Cube Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 2580 Accepted Submission(s): 955 Problem Description The P...
2018-10-08 12:01:37
531
原创 hdu 3549 Flow Problem (最大流 EK)
Flow Problem Time Limit: 5000/5000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others) Total Submission(s): 22504 Accepted Submission(s): 10516 Problem Description N...
2018-10-01 16:56:02
251
原创 hdu 1520 Anniversary party(树形dp)
Anniversary party Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 18069 Accepted Submission(s): 6792 Problem Description...
2018-09-23 19:46:16
167
原创 hdu 1524 A Chess Game(SG函数)
A Chess Game Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 2554 Accepted Submission(s): 1153 Problem Description Let...
2018-09-17 11:29:13
403
原创 java 遍历日期
java 遍历开始到结束的日期import java.text.ParseException;import java.text.SimpleDateFormat;import java.util.Calendar;import java.util.Date;public class Main { public static void main(String[] args) {...
2018-09-11 11:51:33
4377
原创 poj 2449 Remmarguts' Date(A*+spfa)
Remmarguts' DateTime Limit: 4000MS Memory Limit: 65536K Total Submissions: 37028 Accepted: 10206 Description"Good man never makes girls wait or breaks an appointment!" said the...
2018-09-09 21:54:27
244
原创 hdu 1245 Saving James Bond(dijkstra)
Saving James Bond Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 3973 Accepted Submission(s): 838 Problem Description ...
2018-07-30 20:20:25
239
原创 hdu 1317 XYZZY (bellman_ford+floyd)
XYZZY Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 7069 Accepted Submission(s): 2022 Problem Description It has rec...
2018-07-28 19:12:57
283
原创 hdu 3790 最短路径问题 (Bellman_ford)
最短路径问题Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 34889 Accepted Submission(s): 10204 Problem Description给你n个点,m条无向边,每条边都有长度d和花费p...
2018-07-26 20:35:56
198
原创 hdu 1698 Just a Hook (线段树+区间更新)
Just a HookTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 41150 Accepted Submission(s): 19840 Problem DescriptionIn the game of DotA...
2018-07-26 10:13:34
190
原创 hihoCoder #1139 : 二分·二分答案 (二分搜索+BFS)
#1139 : 二分·二分答案时间限制:10000ms单点时限:1000ms内存限制:256MB描述在上一回和上上回里我们知道Nettle在玩《艦これ》,Nettle在整理好舰队之后终于准备出海捞船和敌军交战了。在这个游戏里面,海域是N个战略点(编号1..N)组成,如下图所示其中红色的点表示有敌人驻扎,猫头像的的点表示该地图敌军主力舰队(boss)的驻扎点,虚线表示各个战略...
2018-07-21 16:48:27
253
原创 hdu1217Arbitrage (Bellman)
Arbitrage Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 9624 Accepted Submission(s): 4393 Problem DescriptionArbitrage is the...
2018-06-17 17:54:48
212
原创 hdu1896 Stones (优先队列)
Stones Time Limit: 5000/3000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others) Total Submission(s): 3700 Accepted Submission(s): 2417 Problem Description Be...
2018-06-10 19:47:57
293
原创 hdu1394 Minimum Inversion Number(线段树+单点更新)
Minimum Inversion Number Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 23159 Accepted Submission(s): 13765 Problem Description...
2018-05-27 20:59:24
150
原创 CodeForces - 48D Permutations题解
A permutation is a sequence of integers from 1 to n of length n containing each number exactly once. For example, (1), (4, 3, 5, 1, 2), (3, 2, 1) are permutations, and (1, 1), (4, 3, 1), (2, 3, 4) are...
2018-05-13 20:56:02
545
原创 2018年北京信息科技大学第十届程序设计竞赛暨ACM选拔赛 A题题解
链接:https://www.nowcoder.com/acm/contest/118/A来源:牛客网时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 32768K,其他语言65536K 64bit IO Format: %lld题目描述 最近,喜爱ACM的PBY同学沉迷吃鸡,无法自拔,于是又来到了熟悉的ERANGEL。经过一番搜寻,PBY同学准备动身前往安全区,但是,地图中埋...
2018-05-06 22:31:40
522
原创 hdu1532Drainage Ditches(Ford-Fulkerson)
Drainage Ditches Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 20940 Accepted Submission(s): 10056 Problem DescriptionEvery t...
2018-04-29 21:00:02
168
原创 poj 2386 Lake Counting (DFS或BFS)
Language:Default Lake Counting Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 41740 Accepted: 20708 Description Due to recent rains, w...
2018-04-22 23:03:57
236
原创 hdu 2136 Largest prime factor题解
Largest prime factorTime Limit: 5000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 15589 Accepted Submission(s): 5406Problem DescriptionEverybody knows any ...
2018-04-15 22:44:28
267
原创 SCU - 4440 2015年四川省程序ACM设计竞赛E题目
Rectanglefrog has a piece of paper divided into nn rows and mm columns. Today, she would like to draw a rectangle whose perimeter is not greater than kk.There are 88 (out of 99) ways when n=m=2,k=6n=m...
2018-04-08 20:24:32
454
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人