
贪心
wang_hoho
这个作者很懒,什么都没留下…
展开
-
17 多校 3 - 1005 - RXD and dividing (HDU 6060)
RXD and dividingTime Limit: 6000/3000 MS (Java/Others) Memory Limit: 524288/524288 K (Java/Others)Total Submission(s): 1432 Accepted Submission(s): 615Problem DescriptionRXD has原创 2017-08-03 20:43:36 · 262 阅读 · 0 评论 -
2017湖南大学ACM程序设计新生杯大赛 - B - Build (并查集+贪心)
题目连接题意:有n个城市,m条道路,每条道路都有一个建造费用只能建成建造费用<=k的道路已知k,求能互相连通的城市最多有多少对就是说求把<=k的路都建好了之后,每个集合的互相连通的点数之和一个集合中互相连通的点数 = p*(p-1)/2 其中p为集合中点的个数 ,这样的操作次数就是n*m,显然不行当两个不相连的城市团A,B合并时,会产生siz...原创 2018-01-21 22:36:09 · 1393 阅读 · 2 评论 -
Codeforces Round #460 (Div.2) - A - Supermarket
A. Supermarkettime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputWe often go to supermarkets to buy some frui原创 2018-02-04 10:01:33 · 211 阅读 · 0 评论 -
Codeforces Problem - 37B - Computer Game (贪心、模拟)
B. Computer Gametime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputVasya’s elder brother Petya loves playing computer games. In one of his favourite c...原创 2018-03-30 10:11:15 · 381 阅读 · 0 评论 -
2018年全国多校算法寒假训练营练习比赛(第四场) - D - 小明的挖矿之旅(贪心)
链接:https://www.nowcoder.com/acm/contest/76/D来源:牛客网题目描述 这个挖矿游戏会给出一个n*m个格子的地图,每个格子都有黄金。在游戏开始时小明会随机出现在地图的某一个格子当中。小明可以将他所在的格子的黄金收归囊中,并且还可以向下或者向右移动,然后继续收集黄金。地图上某些格子是障碍物,小明不能移动到有障碍物的格子上。不过,在游戏开始时,小...原创 2018-02-22 12:05:46 · 621 阅读 · 0 评论 -
HDU - 5461 - Largest Point(贪心,分类讨论)
HDU - 5461 - Largest Point题意:有一个数列 t ,以及两个整数a,b,求 的最大值。 只要找出t中最小值,次小值,最大值,次大值,绝对值最小值,然后全排列就能得到答案,注意不能取同一个#include <iostream>#include <string.h>#include <stdio.h>#incl...原创 2018-07-31 20:46:45 · 171 阅读 · 0 评论 -
HDU - 6335 - Problem D. Nothing is Impossible(贪心)
HDU - 6335 - Problem D. Nothing is Impossible#include <iostream>#include <stdio.h>#include <string.h>#include <algorithm>using namespace std;typedef long long int LL;...原创 2018-08-09 23:11:38 · 276 阅读 · 0 评论 -
HDU - 6376 - 度度熊剪纸条(贪心)
HDU - 6376 - 度度熊剪纸条 所有的连续的一可以分为三个部分。第一个部分是刚开始的连续的1,然后是末尾的连续的1,再就是中间部分的连续的1 第一种如果做前缀1的末尾,则其花费为0第二种要用的话花费为1第三种做前缀末尾,则其花费为1,否则花费为2然后就是求出较大的即为答案#include <iostream>#include <stri...原创 2018-08-13 19:34:42 · 392 阅读 · 0 评论 -
HDU - 6408 - From ICPC to ACM(贪心)
HDU - 6408 - From ICPC to ACM题意:已知 k 个月每个月的具体信息,求满足客人需求的最小花费。每个月的信息如下:ci 表示第 i 个月的原材料价格di 表示第 i 个月需要卖出的电脑数量(顾客在第 i 个月的需求)mi 表示第 i 个月生产一台电脑的花费pi 表示第 i 个月能生产的电脑数量 ei 表示第 i 个月可以存到下个月的电...原创 2018-08-17 19:19:44 · 452 阅读 · 0 评论 -
ZOJ - 3987 - Numbers (高精度,贪心)
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.原创 2017-12-19 15:59:59 · 453 阅读 · 0 评论 -
Codeforces Testing Round #14 (Unrated) - C - Minimum Sum (排序)
C. Minimum Sumtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputPetya has n positive integers a1, a2, ..., an原创 2017-12-22 21:36:59 · 354 阅读 · 0 评论 -
POJ - 3111 - K Best (最大化平均值)
K BestTime Limit: 8000MS Memory Limit: 65536KTotal Submissions: 11571 Accepted: 2983Case Time Limit: 2000MS Special JudgeDescriptionDemy has n jewels.原创 2017-11-03 18:43:35 · 423 阅读 · 0 评论 -
17 多校 - 1 - 1002 - Balala Power! (HDU 6034)
Balala Power!Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 3961 Accepted Submission(s): 962Problem DescriptionTalente原创 2017-07-26 20:26:20 · 244 阅读 · 0 评论 -
16 多校 8 - A - Ball (HDU - 5821)
贪心,就是每次移动都要接近终点一些,所以首先要把每个点的终点位置给找出来代替原来数组中的数字,然后操作时就对[l,r]区间数的终点位置从小到大进行排序就可以了,最后判断是否为a[i] = i。#include<iostream>#include<stdio.h>#include<string.h>#include<algorithm>using namespace std;int t,n,原创 2017-07-19 18:22:12 · 220 阅读 · 0 评论 -
16 多校 6 - J - Windows 10 (HDU - 5802)
题目大意就是增加音量时每次只能增加1,连续降低音量时第一次降低1之后连续的每次都降低上次降低音量的两倍,停顿一秒或在一秒内增加1音量都可打断。求最少要多少时间使得音量从p到q。从题意可得可将数据分为两种 一种为 p<=q 此时所需最少时间为q - p,另一种为p>q,为了时间最短,所以要尽量多的连续减小音量,此时就分成了两个部分,一个是减少到q以下,然后再加到q,另一个是减少到q以上,且再多减一次就原创 2017-07-19 17:35:52 · 210 阅读 · 0 评论 -
HDU - 1789 - Doing Homework again
Doing Homework againTime Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 13948 Accepted Submission(s): 8095Problem DescriptionIgnatius has just c原创 2017-05-18 13:12:28 · 212 阅读 · 0 评论 -
Codeforces Educational Codeforces Round 31 - C - Bertown Subway
C. Bertown Subwaytime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe construction of subway in Bertown is a原创 2017-10-28 11:24:29 · 408 阅读 · 0 评论 -
Codeforces Problem 333B - Chips
B. Chipstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputGerald plays the following game. He has a checkered原创 2017-10-22 10:59:05 · 309 阅读 · 0 评论 -
Codeforces Educational Codeforces Round 31 - D - Boxes And Balls(哈夫曼)
D. Boxes And Ballstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputIvan has n different boxes. The first of原创 2017-11-01 10:52:58 · 243 阅读 · 0 评论 -
Codeforces Problem 332C - Student's Revenge(未A)
C. Students' Revengetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputA student's life is fraught with compl原创 2017-10-24 15:51:39 · 277 阅读 · 0 评论 -
HDU - 6435 - Problem J. CSGO(枚举)
HDU - 6435 - Problem J. CSGO题意:有 n 把主武器和 m 把副武器,每把武器有 k 种属性 x[i] 和综合得分 S,从中取出主副武器各一把求 的最大值其中MW表示主武器相关信息,SW表示副武器相关信息 如果绝对值不存在,我们只要找出 和 两者相加即为答案因为带有绝对值,处理变得不方便了,所以我们要去绝对值,由于 K 最大为 5 所以去...原创 2018-08-23 11:22:34 · 277 阅读 · 1 评论