Educational Codeforces Round 34】的更多相关文章

Educational Codeforces Round 34 (Rated for Div. 2) A Hungry Student Problem 题目链接: http://codeforces.com/contest/903/problem/A 思路: 直接模拟 代码: #include <bits/stdc++.h> using namespace std; int main() { int n; scanf("%d",&n); while(n--) { i…
F - Clear The Matrix 分析 题目问将所有星变成点的花费,限制了行数(只有4行),就可以往状压DP上去靠了. \(dp[i][j]\) 表示到第 \(i\) 列时状态为 \(j\) 的花费,只需要记录 16 位二进制,因为我们最多只能影响到 4 * 4 的星,那么每次都是从一个 4 * 4 的矩阵转移到一个 4 * 4 的矩阵,注意,转移时必须保证最左边列全部为 1 (即都是星号),那么最后答案就是 \(dp[n][(1 << 16) - 1]\). 比如我们选定点 (i,…
D. Almost Difference Let's denote a function You are given an array a consisting of n integers. You have to calculate the sum of d(ai, aj) over all pairs (i, j) such that 1 ≤ i ≤ j ≤ n. Input The first line contains one integer n (1 ≤ n ≤ 200000) — t…
C. Boxes Packing time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Mishka has got n empty boxes. For every i (1 ≤ i ≤ n), i-th box is a cube with side length ai. Mishka can put a box i into a…
D. Almost Difference time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Let's denote a function You are given an array a consisting of n integers. You have to calculate the sum of d(ai, aj) o…
C. Boxes Packing time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Mishka has got n empty boxes. For every i (1 ≤ i ≤ n), i-th box is a cube with side length ai. Mishka can put a box i into a…
B. The Modcrab time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Vova is again playing some computer game, now an RPG. In the game Vova's character received a quest: to slay the fearsome mons…
A. Hungry Student Problem time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Ivan's classes at the university have just finished, and now he wants to go to the local CFK cafe and eat some frie…
A. Hungry Student Problem time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Ivan's classes at the university have just finished, and now he wants to go to the local CFK cafe and eat some frie…
B. The Modcrab Vova is again playing some computer game, now an RPG. In the game Vova's character received a quest: to slay the fearsome monster called Modcrab. After two hours of playing the game Vova has tracked the monster and analyzed its tactics…