C - 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…
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…
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…
题目链接: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<…
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 grow,…
layout: post title: Codeforces Round 252 (Div. 2) author: "luowentaoaa" catalog: true tags: mathjax: true - codeforces - 群论 --- 传送门 A.Valera and Antique Items (签到) 题意 如果当前钱数比一组数中最小的还要大就+1 思路 直接模拟 #include<bits/stdc++.h> using namespace std…