贪心
AAAAAAAC——
.。。。。。。。。。。。。
展开
-
cf Hello 2018 C. Party Lemonade
题目地址题目大意:给出n个瓶子,每个瓶子能装2^(n-1)柠檬水,给出瓶子的价格,输出至少装L升柠檬水需要的瓶子价格感想:这场比赛我并没有打,第二点跟同学讨论这个题,发现这个题有点意思思路:这个题一看就是贪心,不过这个题贪心的有点新意代码:#include using namespace std;typedef long long ll;int N, L;ll C[32原创 2018-01-09 09:27:17 · 231 阅读 · 0 评论 -
The 2016 ACM-ICPC Asia China-Final (Shanghai) Contest---重现赛题解
A - Number Theory Problem(规律)题意:Mr. Panda is one of the top specialists on number theory all over the world. Now Mr. Panda is investigating the property of the powers of 2. Since 7 is the lucky nu...原创 2018-10-07 17:57:20 · 1012 阅读 · 0 评论 -
The 2016 ACM-ICPC Asia Dalian Regional Contest---题解
A - Wrestling Match(二分图染色/2-set/dfs瞎搞均可) 题意:Nowadays, at least one wrestling match is held every year in our country. There are a lot of people in the game is “good player”, the rest is “bad playe...原创 2018-10-03 17:17:26 · 406 阅读 · 0 评论 -
ACM-ICPC 2018 沈阳赛区网络预赛
D. Made In HeavenA*算法,第k短路,套模板即可#include<bits/stdc++.h>using namespace std;#define INF 0xffffff#define MAXN 100010namespace fastIO { #define BUF_SIZE 100000 //fread -> read bool ...原创 2018-09-09 20:42:41 · 165 阅读 · 0 评论 -
2018中国大学生程序设计竞赛 - 网络选拔赛
1001.Buy and Resell思路:贪心,以前见过不少类型的,队友做的,直接上代码了;代码:#include<bits/stdc++.h>using namespace std;struct sell{ long long int val; bool operator<(const sell &aa)const ...原创 2018-08-26 16:35:59 · 3951 阅读 · 0 评论 -
Codeforces Round #503 (by SIS, Div. 2)
A:New Building for SIS 水题思路:注意在同一幢楼上时,直接上下走就可以,不用非得经过【a,b】层代码:(我还是写复杂了,直接按照左右走求三段就可以了)#include<bits/stdc++.h>using namespace std;const int N = 15;const int inf = 1000000000;int n,h,a...原创 2018-08-13 10:02:09 · 170 阅读 · 0 评论 -
HDU 5303--Delicious Apples
http://acm.hdu.edu.cn/showproblem.php?pid=5303题意:长度为L的圈上,有n棵苹果树,每次最多摘k个,求把所有苹果树上的苹果都摘回起点0上的最短距离。所有树上的苹果总和不超过1e5.思路:有点贪心思想,苹果取回,要么取了原路返回,要么绕一圈再回去。但是可以发现,绕一圈的情况最多有一次,从中间平分,左后两边能满k运回去的,一定原路返回优于绕圈,因为有...原创 2018-07-17 15:53:42 · 140 阅读 · 0 评论 -
cf--Ran and the Lock Code
题意:n个数的平均值是a,求n个数的组成中,最多有多少个不同的数思路:n个数的和是sum=n*a,假设有x个数不同,可以把这x个数化成1.2.3....x,(这x个数取最小,最小是1,2,3...x,)剩下的(n-x)个数的和是s=(sum-((1+x)*x/2)),因为每个数都是>=1的数,所以s>=(n-x);代入得(1+x)*x/2+(n-x)<=(n*a);因为对x在[1...原创 2018-05-14 18:13:57 · 180 阅读 · 0 评论 -
牛客--最小化价格
题意:点击打开链题意:现有n组人,m个地点,给出每组人的人数,每个地点可容纳的最大人数和选择的价格,要求一种方式,使得每组人都到一个各不相同的地点,最小化选择的价格 。每个队伍的人都要在同一个地方每个地方只能有一个队伍思路:n组从大到小,把能装下当前组的地点价格放进multiset,(注意价格可能重,所以不能set)每次都取最优的,价钱最小的,感想:这是第一次,完全靠自己想到用set,进而想到mu...原创 2018-05-11 22:19:15 · 247 阅读 · 0 评论 -
2019年第十届“浪潮杯”山东省大学生ACM程序设计竞赛--解题报告
目录A、 calandarB、Flipping GameC、Wandering RobotD、Game on a GraphE、BaoBao Loves ReadingF、Stones in the BucketG、Heap,H、Tokens on the SegmentsI、Connected IntervalsJ 、riangle CityK、Ha...原创 2019-05-13 12:47:41 · 1786 阅读 · 2 评论