贪心
lizhaowei213
活着就为改变世界!
展开
-
HDU 1789 Doing Homework again
A - Doing Homework againTime Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64uSubmitStatusPracticeHDU 1789DescriptionIgnatius has just come back school from the 30t原创 2015-08-08 20:18:28 · 335 阅读 · 0 评论 -
UVA 11729 Commando War
UVA - 11729寒假到了,刷题又开始了。贪心小水题按照J的值排降序,判断做完上一次最耗时的事情后,这一次做完结束的时间是在后还是在前,在前则表明上一次做完的时候,这一次早已做完,在后,则取B的累加+这一次的J#include#include#define N 1005using namespace std;typedef struct{原创 2016-01-13 18:59:50 · 327 阅读 · 0 评论 -
CodeForces 617A Elephant
A. Elephanttime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAn elephant decided to visit his friend. It turned out tha原创 2016-01-26 12:54:21 · 323 阅读 · 0 评论 -
CSU 1098 Happy watering
1098: Happy wateringTime Limit: 1 Sec Memory Limit: 16 MBSubmit: 132 Solved: 60[Submit][Status][Web Board]DescriptionGBQC国的小明家里有N棵树,每天小明都会给其中一棵树浇水,每次浇水后,树都会长高一些,但由于树的品种不同,每次增长的高度也有所区别。原创 2016-01-23 18:49:56 · 490 阅读 · 0 评论 -
POJ 3617 Best Cow Line
Best Cow LineTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 15366 Accepted: 4343DescriptionFJ is about to take his N (1 ≤ N ≤ 2,000) cows to the annu原创 2016-01-23 12:38:59 · 271 阅读 · 0 评论 -
UVA 11292 Dragon of Loowater
https://uva.onlinejudge.org/external/112/11292.pdf赤裸裸的贪心算法,大白书第一题,开刷。#include#include#define N 20005using namespace std;int dragon[N],knight[N];int main(){ int n,m;原创 2015-12-02 00:31:44 · 331 阅读 · 0 评论 -
CodeForces 584E Anton and Ira
E. Anton and Iratime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAnton loves transforming one permutation into another原创 2016-01-20 09:20:40 · 364 阅读 · 0 评论 -
CodeForces 527D Clique Problem
D. Clique Problemtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe clique problem is one of the most well-known NP原创 2016-01-19 08:30:28 · 465 阅读 · 0 评论 -
Code Forces 525C Ilya and Sticks
E - ETime Limit:2000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64uSubmitStatusPracticeCodeForces 525CDescriptionIn the evening, after the contest Ilya was bored, and he原创 2015-08-08 20:03:30 · 465 阅读 · 0 评论 -
Code Forces 462B Appleman and Card Game
D - DTime Limit:1000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64uSubmitStatusPracticeCodeForces 462BDescriptionAppleman has n cards. Each card has an uppercase lette原创 2015-08-16 14:21:27 · 639 阅读 · 0 评论 -
UVA 11300 Spreading the Wealth
UVA - 11300分金币问题,大白书上的一道题,具体的过程第一次看的感觉很神奇,后来边看边想,确实这个中位数求的很有道理。这道题通过建模列n个方程,可以抽象成给定数轴上n个点,在数轴上的所有点中,中位数离所有点的距离之和最小。想了想,假设最优点向中位数点左侧移动d距离,那么原来在左边的点距离之和减去a个d,原来在右边的点距离之和加上a个d.总距离不变。但是中位数和最优点之间原创 2016-01-13 22:06:58 · 247 阅读 · 0 评论