
ACM_贪心
文章平均质量分 74
深海沧澜夜未央
这个作者很懒,什么都没留下…
展开
-
HDU - 4726 Kia's Calculation (贪心 数字加和错误运算处理)
告诉起亚医生如何计算两个整数的总和。但起亚是这么粗心,总是两位数字超过9时忘记携带一个数字。例如,当她计算4567 + 5789时,她将得到9246,而1234 + 9876,她将得到0.酥油生气关于这个,为她解决了一个难题:现在起亚有两个整数A和B,她可以按照自己喜欢的顺序对每个数字中的数字进行混洗,但是不允许前导零。也就是说,对于A = 11024,她可以将数字重新排列为10124或411原创 2017-12-16 17:19:15 · 328 阅读 · 0 评论 -
搬书 HNUST 1885(贪心 头尾2侧一共最多选2个放入包中)
XCQ队长要退役啦,由于队长常年刷题,机位上摆着各类算法书,一个人实在是搬不动,所以他叫来了他的小弟ZZX帮忙搬书。队长突然灵机一动,给ZZX出了一个问题。假设机位上有n本书,每本书的体积分别为ai,那么如果使用容量为V的书包来装书最少要几个书包呢?(注意书是不可拆分的,整体要么装到一个书包,要么不装)。ZZX(冥思苦想): 不会呀。XCQ: 看你这么弱,我就把原创 2017-12-18 20:41:25 · 430 阅读 · 0 评论 -
AtCoder Grand Contest 020 B - Ice Rink Game(贪心+计算机乘法)
Time limit : 2sec / Memory limit : 512MBScore : 500 pointsProblem StatementAn adult game master and N children are playing a game on an ice rink. The game consists of K rounds. In the原创 2018-01-18 12:35:07 · 448 阅读 · 0 评论 -
EOJ Monthly 2017.12 易位构词(贪心+STL特性容器 +头文件<bits/stdc++.h> )未解决
易位构词 (anagram),指将一个单词中的字母重新排列,原单词中的每个字母都出现有且仅有一次。例如 "unce" 可以被易位构词成 "ecnu"。在某些情况下,要求重排而成的依然是一个单词,但本题没有这种要求,因为我们根本没有词典。我们所感兴趣的是,有些单词中的字母进行适当的重排后,可以使得构成的单词每个对应的位置上字母都不一样。例如 "unce" 和 "ecnu",就有 "u" ≠ "e",原创 2017-12-09 20:35:58 · 430 阅读 · 0 评论 -
AtCoder Regular Contest 092 C - 2D Plane 2N Points 贪心 匈牙利算法模板
Problem StatementOn a two-dimensional plane, there are N red points and N blue points. The coordinates of the i-th red point are (ai,bi), and the coordinates of the i-th blue point are (ci,di).A red...原创 2018-03-18 17:48:17 · 443 阅读 · 0 评论 -
第十六届北京师范大学程序设计竞赛决赛 D. 雷电爆裂之力
听说导体切割磁感线可以发电? 今天,zhuaiballl想要做切割磁感线运动,感受雷电的力量。 南北方向有四条马路,从西到东依次是京师路,木铎路,金声路和新街口外大街,可以看成是四条平行的数轴,且相邻的两条数轴之间距离为1m。东西走向有许多小道连接了相邻的马路。假设地磁南极和地理北极重合,地磁北极和地理南极重合。现在zhuaiballl位于京师路的某个位置,想要出发前往新街口外大街,速度为1m/s...原创 2018-04-09 10:33:00 · 465 阅读 · 0 评论 -
HDU 6299 Balanced Sequence 括号匹配 贪心
Problem DescriptionChiaki has n strings s1,s2,…,sn consisting of '(' and ')'. A string of this type is said to be balanced:+ if it is the empty string+ if A and B are balanced, AB is balanced,+ i...原创 2018-07-26 19:20:13 · 299 阅读 · 0 评论 -
Kattis - palindromicpassword Palindromic Password 求最接近的回文数
The IT department at your school decided to change their password policy. Each password will have to consist of N 6-digit numbers separated by dashes, where N will be determined by the phase of the mo...原创 2018-07-30 11:00:12 · 367 阅读 · 0 评论 -
POJ 2054 /HDU 1055 Color a Tree(贪心+并查集)
Bob is very interested in the data structure of a tree. A tree is a directed graph in which a special node is singled out, called the "root" of the tree, and there is a unique path from the root to ea...原创 2018-07-27 15:46:36 · 321 阅读 · 1 评论 -
POJ 3190 -Stall Reservations 小根堆 贪心 区间问题
Oh those picky N (1 <= N <= 50,000) cows! They are so picky that each one will only be milked over some precise time interval A..B (1 <= A <= B <= 1,000,000), which includes both times ...原创 2018-08-02 15:15:59 · 319 阅读 · 0 评论 -
HDU - 1051 Wooden Sticks (贪心 区间包含)
有一堆木棍。预先知道每根棒的长度和重量。木棍要一个接一个地由木工机加工。它需要一些时间,称为设置时间,为机器准备处理棒。安装时间与清洁操作和更换机器中的工具和形状有关。木工机器的安装时间如下:(a)第一根木棒的准备时间是1分钟。(b)在处理长度l和重量w的棒之后,如果l 你要找到最小的安装时间来处理一堆n木棍。例如,如果你有五个长度和重量为(4,9),(5,2),(2,原创 2017-12-16 17:12:47 · 365 阅读 · 0 评论 -
HDU - 1009 FatMouse'Trade (贪心单个价值)
FatMouse准备了M磅的猫粮,准备和守卫仓库里的猫交易,里面装着他最喜欢的食物,JavaBean。仓库有N个房间。第i间房间包含J磅重的JavaBeans,需要F [i]磅的猫粮。 FatMouse不必交易房间里所有的JavaBeans,相反,如果他付了一磅猫食,他可能会得到一磅JavaBeans。这里是一个实数。现在他把这个作业分配给你:告诉他他可以获得的最大JavaBeans数量。原创 2017-12-16 17:08:22 · 558 阅读 · 0 评论 -
贪心 HDU 5014
Problem DescriptionThere is a special number sequence which has n+1 integers. For each number in sequence, we have two rules:● ai ∈ [0,n] ● ai ≠ aj( i ≠ j )For sequence a and seq原创 2017-01-18 11:00:47 · 328 阅读 · 0 评论 -
Meeting Room Arrangement
Faculty of Engineering of PSU has a large meeting room for faculty staff to organize events and meetings.The use of the meeting room must be reserved in advance. Since the meeting room is available原创 2017-04-30 16:29:48 · 637 阅读 · 0 评论 -
Contest Strategy
As you are a contestant participating in an ACM-ICPC contest, your goal is to solve as many problemsas you can within the competition duration with the least total time possible.Let’s suppose that原创 2017-04-30 16:38:48 · 409 阅读 · 0 评论 -
浙江省赛 D Let's Chat
ACM (ACMers' Chatting Messenger) is a famous instant messaging software developed by Marjar Technology Company. To attract more users, Edward, the boss of Marjar Company, has recently added a new feat原创 2017-04-23 11:47:48 · 598 阅读 · 0 评论 -
POJ - 3122 Pie (二分+贪心 计算个数)
题意:给出n个朋友,m个苹果派,再给出m个苹果派的半径,求出可以分给n个朋友一摸一样的苹果派的最大面积(不可以拼凑,只可以是一整块)。思路:贪心+二分#include #include #include #include #include #include #include using namespace std;#define pi acos(-1.0)#define原创 2017-12-24 09:37:14 · 313 阅读 · 0 评论 -
POJ - 1064 Cable master(二分+贪心 计算个数)
题意:给出n,m,给出n个电缆,求出满足电缆分割后满足m个的电缆的最大长度思路:二分分割后的电缆长度,二分时 计算出在当前分割电缆长度下可以有多少个电缆include #include #include #include #include #include #include using namespace std;typedef long long ll;int n,k;原创 2017-12-24 09:27:16 · 272 阅读 · 0 评论 -
POJ 2456 Aggressive cows(二分+贪心 计算个数)
Farmer John has built a new long barn, with N (2 <= N <= 100,000) stalls. The stalls are located along a straight line at positions x1,...,xN (0 <= xi <= 1,000,000,000).His C (2 <= C <= N) cows原创 2017-02-05 16:40:42 · 411 阅读 · 0 评论 -
Hold不住的老师 HNUST 1588
题目描述 因为我们学校ACM集训队取得的一个个优异成绩,ACM/ICPC越来越受到学校重视。学校为了提高大家的编程与算法能力,决定开设更多的上机课。但是大家的学习热情实在太高了,提出来的问题层出不穷,我们的老师们Hold不住了,于是老师决定让我们优秀的集训队员们来给大家指导上机。我们集训队的队员们精力非常充沛,一天到晚都是空闲时间,只要老师召唤并且要去指导的上机课的时间不冲突,那他们就一定会去原创 2017-12-15 18:17:50 · 331 阅读 · 0 评论 -
HDU - 2570 迷瘴 (贪心水题)
通过悬崖的yifenfei,又面临着幽谷的考验——幽谷周围瘴气弥漫,静的可怕,隐约可见地上堆满了骷髅。由于此处长年不见天日,导致空气中布满了毒素,一旦吸入体内,便会全身溃烂而死。幸好yifenfei早有防备,提前备好了解药材料(各种浓度的万能药水)。现在只需按照配置成不同比例的浓度。现已知yifenfei随身携带有n种浓度的万能药水,体积V都相同,浓度则分别为Pi%。并且知道,针对当时原创 2017-12-16 16:58:06 · 741 阅读 · 0 评论 -
POJ - 1456 Supermarket 贪心+并查集 /小根堆
A supermarket has a set Prod of products on sale. It earns a profit px for each product x∈Prod sold by a deadline dx that is measured as an integral number of time units starting from the moment th...原创 2018-08-02 15:40:51 · 420 阅读 · 0 评论