
贪心
文章平均质量分 54
Achanss
My life is good, and u just make it better!
展开
-
UPC——7226: Memory Banks(贪心+细节处理)
7226: Memory Banks时间限制: 1 Sec 内存限制: 256 MB提交: 224 解决: 47[提交] [状态] [讨论版] [命题人:admin]题目描述We have purchased 60 different types of memory banks, typed as 0 to 59, A bank of type i has 2i memory ...原创 2018-09-13 19:56:49 · 642 阅读 · 0 评论 -
CodeForce-1066B. Heaters(贪心)
#B. Heaters##传送门###Vova’s house is an array consisting ofnn elements (yeah, this is the first problem, I think, where someone lives in the array). There are heaters in some positions of the array....原创 2018-10-14 11:07:34 · 585 阅读 · 0 评论 -
CodeForce 1064-D. Labyrinth(双端队列)
D. Labyrinthtime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputYou are playing some computer game. One of its levels puts you in a maze consisti...原创 2018-10-15 17:17:44 · 637 阅读 · 0 评论 -
codeforce—1054D. Changing Array
codeforce—1054D. Changing Array传送门D. Changing Arraytime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAt a break Vanya came to the class and sa...原创 2018-10-19 22:31:49 · 604 阅读 · 0 评论 -
CodeForces ——C. Cram Time ( 二分 + 贪心 )
CodeForces ——C. Cram Time题目链接解题报告:贪心的思想,从1开始找一个范围**[1,n]**,读完这个范围内的所有讲义一定就是最多的讲义数啦~~emmmmmm二分找一个最佳的n 满足 n*(n+1)/2 <= sum(a+b) 就行好啦,嘻嘻。 可以对n预先优化(当然不优化直接带 n = sum也可以AC ),因为n不可能== sum(a+b) , ...原创 2018-10-23 17:03:39 · 540 阅读 · 0 评论 -
YTU 3172: 最公正的裁判
题目链接AC代码:思路:模拟找一个最佳裁判,排序,找出 给出的分数与平均值之差最小的 ,往前找同样分数下编号最靠前的#include<iostream>#include<algorithm> using namespace std;typedef struct{ int v; int p;}num;num a[20]; ...原创 2017-06-01 20:18:56 · 450 阅读 · 0 评论 -
CodeForces —— 1075 C. The Tower is Going Home(思维 + 贪心)
C. The Tower is Going Hometime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputOn a chessboard with a width of 109and a height of 109, the row...原创 2018-11-09 13:14:42 · 672 阅读 · 0 评论 -
E. Two Arrays and Sum of Functions (math + greedy)
题目链接统计求和公式中每个a[i]b[i]对答案的贡献,每个位置i会提供的(i+1)(n-1-i)次,题目要求只能移动b数组,故可用贪心思想:将a[i](i-1)(n-1-i) 较小的 * b[i]中较大的,相当于对每个固定不动的a[i]都找一个最佳的b[i]匹配,简单排序即可实现。/** @Author: Achan* @Date: 2019-05-15 21:34:08* @La...原创 2019-05-16 17:44:04 · 204 阅读 · 0 评论