题目链接:Codeforces 441C Valera and Tubes 没看到r >= 2一直错.让前几个管子占用2个格子.最后一个把剩下的都占用了.假设问题有解.这样做一定有解.其它策略就不一定了(比方让某个管子占用了3个格子.而总共同拥有四个格子,两个管子). #include <iostream> #include <cstdio> using namespace std; int main() { int n, m, k; scanf("%d%d%d&q…
C. Valera and Tubes time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Valera has got a rectangle table consisting of n rows and m columns. Valera numbered the table rows starting from one, fr…
题目链接:http://codeforces.com/problemset/problem/441/B 题目意思:有 n 棵fruit trees,每课水果树有两个参数描述:水果成熟的时间和这棵树上水果的数量.已知Valera 每天最多可以采摘 v 个水果,而每棵fruit tree能被采摘水果的天数只能在它水果成熟的那一日(ai)和后一日(ai+1),超过这两日就不能采摘这棵树的水果了.问如何操作可以使最后采摘到的水果数最多. 实不相瞒,做这条题做得蛮久的,可能与忙于考试没怎么做题有关....…
题目链接:http://codeforces.com/problemset/problem/369/B 题目意思:给出6个整数, n, k, l, r, sall, sk ,需要找出一个满足下列条件的序列:1. l <= 每一个数 <= r 2.整个序列的数的和为sall 3.取得最高分数的那k个人的总分数恰好(注意,是刚刚好,多了或少了都不可,而且这k个人的分数不一定都是相等的)等于sk.(至于后面的那句 if a1, a2, ..... sk = a1 + a2 + ...…
Valera is a coder. Recently he wrote a funny program. The pseudo code for this program is given below: //input: integers x, k, pa = x;for(step = 1; step <= k; step = step + 1){ rnd = [random integer from 1 to 100]; if(rnd <= p) a = a * 2; else a = a…
369C - Valera and Elections 思路:dfs,对于搜索到的每个节点,看他后面有没有需要修的路,如果没有,那么这个节点就是答案. 代码: #include<bits/stdc++.h> using namespace std; #define ll long long #define pb push_back ; vector<int>g[N]; vector<int>edge[N]; vector<int>ans; int dfs(i…