题目链接 参考代码: #include <iostream> using namespace std; int main() { ; int n; cin >> n; ; i <= n; i ++) { ans += i * (i - ); } cout << ans << endl; ; }…
Each month Blake gets the report containing main economic indicators of the company "Blake Technologies". There are n commodities produced by the company. For each of them there is exactly one integer in the final report, that denotes correspond…
https://vjudge.net/problem/2135388/origin Describe You are given an integer sequence 1,2,-,n. You have to divide it into two sets A and B in such a way that each element belongs to exactly one set and |sum(A)−sum(B)| is minimum possible. The value |x…
A. Vladik and Courtesy time limit per test:2 seconds memory limit per test:256 megabytes input:standard input output:standard output At regular competition Vladik and Valera won a and b candies respectively. Vladik offered 1 his candy to Valera. Afte…
题目链接:http://codeforces.com/problemset/problem/1038/D 题意: 给出 $n$ 个史莱姆,每个史莱姆有一个价值 $a[i]$,一个史莱姆可以吃掉相邻的史莱姆,此时其自身的价值就要减掉被吃掉的那个史莱姆的价值. 史莱姆会不断的互相吞噬直到最后只剩一个,要求你该史莱姆可能的最大价值. 题解: 相当于你在 $n$ 个数前面添加 $+$ 或者 $-$,然后拼成一个算式计算答案. 首先考虑到的是,史莱姆的价值是全正或者全负的情况,这样的话,不可能使得所有价值…
Little X used to play a card game called "24 Game", but recently he has found it too easy. So he invented a new game. Initially you have a sequence of n integers: 1, 2, ..., n. In a single step, you can pick two of them, let's denote them a and …
Little Artem is fond of dancing. Most of all dances Artem likes rueda — Cuban dance that is danced by pairs of boys and girls forming a circle and dancing together. More detailed, there are n pairs of boys and girls standing in a circle. Initially, b…
原题链接 参考代码: #include <iostream> #include <cstring> using namespace std; + , INF = 0x3f3f3f3f; int value[maxn], ans[maxn]; bool vis[maxn], flag; int main() { int n; cin >> n; flag = true; memset(vis, false, sizeof vis); ; i < n - ; i ++…
Welcoming autumn evening is the best for walking along the boulevard and npeople decided to do so. The boulevard can be represented as the axis Ox. For every person there are three parameters characterizing the behavior: ti, si, fi — the moment of ti…
Sonya and Robots time limit per test 1 second memory limit per test 256 megabytes input: standard input output: standard output Since Sonya is interested in robotics too, she decided to construct robots that will read and recognize numbers. Sonya has…