Codeforces 441 B. Valera and Fruits】的更多相关文章

B. Valera and Fruits time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Valera loves his garden, where n fruit trees grow. This year he will enjoy a great harvest! On the i-th tree bi fruit gr…
纯粹练JAVA.... A. Valera and Antique Items time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Valera is a collector. Once he wanted to expand his collection with exactly one antique item. Valera…
B. Valera and Fruits time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Valera loves his garden, where n fruit trees grow. This year he will enjoy a great harvest! On the i-th tree bi fruit gr…
B. Valera and Fruits time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Valera loves his garden, where n fruit trees grow. This year he will enjoy a great harvest! On the i-th tree bi fruit gr…
Codeforces#441 Div.2 四小题 链接 A. Trip For Meal 小熊维尼喜欢吃蜂蜜.他每天要在朋友家享用N次蜂蜜 , 朋友A到B家的距离是 a ,A到C家的距离是b ,B到C家的距离是c  (A- >Rabbit   B- >Owl    C ->Eeyore),他不能连续两顿饭都在同一位朋友家里蹭 他现在位于A的家里, 请问他一天最少要跑多少路. 当然是要找一条最短的路折返跑了啊,是不是很简单. #include<bits/stdc++.h> us…
题目链接:http://codeforces.com/problemset/problem/441/B 题目意思:有 n 棵fruit trees,每课水果树有两个参数描述:水果成熟的时间和这棵树上水果的数量.已知Valera 每天最多可以采摘 v 个水果,而每棵fruit tree能被采摘水果的天数只能在它水果成熟的那一日(ai)和后一日(ai+1),超过这两日就不能采摘这棵树的水果了.问如何操作可以使最后采摘到的水果数最多. 实不相瞒,做这条题做得蛮久的,可能与忙于考试没怎么做题有关....…
#include <iostream> #include <vector> #include <algorithm> #include <map> using namespace std; int main(){ int n,v; cin >> n >>v; map<int,int> fruit; ; i < n; ++ i ){ int a,b; cin >>a >> b; if(fruit…
题目倒是不难,可是读起来非常恶心 依据题目的描写叙述不easy找到适合存储的方法 后来我就想不跟着出题人的思路走 我自己开一个数组c 令c[a[i]] = b[i] 则c[i] == [j] 代表第i天相应有j个果子成熟 接着用贪心的方法做就好了 当前天尽可能收取昨天的果子.在收完的情况下再考虑今天的果子 代码例如以下: #include <cstdio> #include <iostream> #include <algorithm> #define MAXN 100…
英语不好就是坑啊.这道题把我坑残了啊.5次WA一次被HACK.第二题得分就比第一题高10分啊. 以后一定要加强英语的学习,要不然就跪了. 题意:有一个果园里有非常多树,上面有非常多果实,为了不然成熟的果实腐烂,必须在两天之内收集起来.给出果园有的树,以及该树上的果实个数,工人每天能够採集的上限,求出这段时间之后,能收集到的最大值. 想法非常easy.优先採集上一天剩下的果实(假设有剩下).假设还能採集再採集今天成熟的果实.假设採集不玩就把当前天数的果实移动到下一天去优先採集. #include<…
Problem description Valera loves his garden, where n fruit trees grow. This year he will enjoy a great harvest! On the i-th tree bi fruit grow, they will ripen on a day number ai. Unfortunately, the fruit on the tree get withered, so they can only be…