Vijos P1987 – 游戏 [贪心]


Link https://vijos.org/p/1987 Problem 小雪与小可可正在玩一种数字游戏。他们准备了n卡片,每一张卡片上都有一个整数。游戏开始后,小雪会先选择一个不小于a且不大于b的整数t,并告诉小可可这个数字t是多少。之后小可可会挑出恰好k张卡片,并将这k张卡片上的数字相...

Vijos P1987 – 游戏 [贪心]

Link https://vijos.org/p/1987 Problem 小雪与小可可正在玩一种数字游戏。他们准备了n卡片,每一张卡片上都有一个整数。游戏开始后,小雪会先选择一个不小于...
阅读全文 0

Vijos P1988 – 自行车比赛 [贪心]


Link https://vijos.org/p/1988 Problem 小雪非常关注自行车比赛,尤其是环滨湖自行车赛。一年一度的环滨湖自行车赛,需要选手们连续比赛数日,最终按照累计得分决出冠军。今年一共有N位参赛选手。每一天的比赛总会决出当日的排名,第一名的选手会获得N点得分,第二...

Vijos P1988 – 自行车比赛 [贪心]

Link https://vijos.org/p/1988 Problem 小雪非常关注自行车比赛,尤其是环滨湖自行车赛。一年一度的环滨湖自行车赛,需要选手们连续比赛数日,最终按照累计...
阅读全文 0

HDU 5821 – Ball [思路/贪心]


Link http://acm.hdu.edu.cn/showproblem.php?pid=5821 Mean 给定两个长度为N的数列A和B,有M次操作,每次可以把Li到Ri段的数字打乱重排,问你能否通过M次操作把A变成B Analysis 多校场上想了好久没想出来,思路越来越不行了,可能是最近花在ACM上的时间越来越少了吧...

HDU 5821 – Ball [思路/贪心]

Link http://acm.hdu.edu.cn/showproblem.php?pid=5821 Mean 给定两个长度为N的数列A和B,有M次操作,每次可以把Li到Ri段的数字打乱重排,问你能否通过M次操...
阅读全文 0

POJ 3617 – Best Cow Line [贪心+枚举]


Link 传送门 Problem FJ is about to take his N (1 ≤ N ≤ 2,000) cows to the annual”Farmer of the Year” competition. In this contest every farmer arranges his cows in a line and herds them past the judges. The contest organizers adopted a...

POJ 3617 – Best Cow Line [贪心+枚举]

Link 传送门 Problem FJ is about to take his N (1 ≤ N ≤ 2,000) cows to the annual”Farmer of the Year” competition. In this contest every...
阅读全文 0

UVa 10535 – Shooter [贪心+几何]


Link 传送门 Problem The shooter is in a great problem. He is trapped in a “2D” maze with a laser gun and can use it once. The gun is very powerful and the laser ray, it emanates can traverse infinite distance in its direction. In the maze the targ...

UVa 10535 – Shooter [贪心+几何]

Link 传送门 Problem The shooter is in a great problem. He is trapped in a “2D” maze with a laser gun and can use it once. The gun is very powerful ...
阅读全文 0

UVa 1344 – Tian Ji — The Horse Racing [贪心+分类讨论]


Link 点击打开题目链接 Problem Were Tian Ji lives in nowadays, he will certainly laugh at himself. Even more, were he sitting in the ACM contest right now, he may discover that the horse racing problem can be simply viewed as finding the maximum ma...

UVa 1344 – Tian Ji — The Horse Racing [贪心+分类讨论]

Link 点击打开题目链接 Problem Were Tian Ji lives in nowadays, he will certainly laugh at himself. Even more, were he sitting in the ACM contest rig...
阅读全文 0

UVa 11134 – Fabled Rooks [贪心]


Link 点击打开题目链接 Problem We would like to place n rooks, 1 ≤ n ≤ 5000, on a n × n board subject to the following restrictions • The i-th rook can only be placed within the rectangle given by its left-upper corner (xli , yli) and its rightlowe...

UVa 11134 – Fabled Rooks [贪心]

Link 点击打开题目链接 Problem We would like to place n rooks, 1 ≤ n ≤ 5000, on a n × n board subject to the following restrictions • The i-th rook ...
阅读全文 0

UVa 10905 – Children’s Game [贪心+排序+思路]


Link 点击打开uva题目链接 Mean 给定n个正整数,你的任务是把他们链接成一个最大的整数。比如,123、124、56、90有24种链接方法,最大的结果是9056124123. Analyse 这个题以前在知乎上看到过,记得是一个人推荐的思维性比较高的面试题。思路实际上就是一个排序,排序...

UVa 10905 – Children’s Game [贪心+排序+思路]

Link 点击打开uva题目链接 Mean 给定n个正整数,你的任务是把他们链接成一个最大的整数。比如,123、124、56、90有24种链接方法,最大的结果是9056124123. An...
阅读全文 1

CodeForces 485C – Bits [二进制]


点击打开codeforces题目链接 题意 给你一个区间[l, r],让你在这个区间内找出一个数,其二进制表示中‘1’的个数最多 分析 这题考察二进制‘或’的性质,可以贪心每次增加一个二进制‘1’位,直到l大于r停止。下面是两种做法 做法一 #include <bits/stdc++.h> usi...

CodeForces 485C – Bits [二进制]

点击打开codeforces题目链接 题意 给你一个区间[l, r],让你在这个区间内找出一个数,其二进制表示中‘1’的个数最多 分析 这题考察二进制‘或’的性质,可以贪心...
阅读全文 0

HDU 5461 – Largest Point [枚举+贪心]


点击打开HDU题目链接 题意 给你一个数列v和a,b,在数列中找两个不同位置的数vi,vj,求a*vi*vi+b*vi的最大值 分析 先对数列排序,枚举i,然后贪心求出j,此时的j要么是数列最大值,要么是数列最小值。注意最后的结果可能会超出int C++代码 #include <bits/stdc++...

HDU 5461 – Largest Point [枚举+贪心]

点击打开HDU题目链接 题意 给你一个数列v和a,b,在数列中找两个不同位置的数vi,vj,求a*vi*vi+b*vi的最大值 分析 先对数列排序,枚举i,然后贪心求出j,此时...
阅读全文 0