纯粹练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…
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 knows n sellers…
A permutation p of length n is a sequence of distinct integers p1, p2, ..., pn (1 ≤ pi ≤ n). A permutation is an identity permutation, if for any i the following equation holds pi = i. A swap (i, j) is the operation that swaps elements pi and pj in t…
B. Divisiblity of Differences time limit per test 1 second memory limit per test 512 megabytes input standard input output standard output You are given a multiset of n integers. You should select exactly k of them in a such way that the difference b…
Ivan and Powers of Two Time Limit:1000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u Submit Status Practice CodeForces 404C Description Valera had an undirected connected graph without self-loops and multiple edges consisting of n ver…
Resort Time Limit:2000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u Submit Status Practice CodeForces 350B Description Valera's finally decided to go on holiday! He packed up and headed for a ski resort. Valera's fancied a ski trip b…
Time Limit:2000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u Submit Status Practice CodeForces 279A Description Valera the horse lives on a plane. The Cartesian coordinate system is defined on this plane. Also an infinite spiral is…
Books CodeForces - 279B When Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to need to…
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…
题目链接:http://codeforces.com/problemset/problem/441/B 题目意思:有 n 棵fruit trees,每课水果树有两个参数描述:水果成熟的时间和这棵树上水果的数量.已知Valera 每天最多可以采摘 v 个水果,而每棵fruit tree能被采摘水果的天数只能在它水果成熟的那一日(ai)和后一日(ai+1),超过这两日就不能采摘这棵树的水果了.问如何操作可以使最后采摘到的水果数最多. 实不相瞒,做这条题做得蛮久的,可能与忙于考试没怎么做题有关....…
题目链接: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…
Codeforces Round #441 (Div. 2) codeforces 876 A. Trip For Meal(水题) 题意:R.O.E三点互连,给出任意两点间距离,你在R点,每次只能去相邻点,要走过n个点,求走过的最短距离. #include<cstdio> #include<cstring> #include<algorithm> using namespace std; int main() { int n, a, b, c; scanf("…
Codeforces Round #441 (Div. 2) A. Trip For Meal 题目描述:给出\(3\)个点,以及任意两个点之间的距离,求从\(1\)个点出发,再走\(n-1\)个点的最短路径. solution 当\(n=1\)时,答案为\(0\),当\(n=2\)时,答案等于与开始点相连的两条边的最小值,当\(n>2\)时,答案等于与开始点相连的两条边的最小值+三条边最小值*\((n-2)\) 时间复杂度:\(O(1)\) B. Divisiblity of Differen…
题目链接: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 + ...…
A. Valera and X time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Valera is a little boy. Yesterday he got a huge Math hometask at school, so Valera didn't have enough time to properly learn…