单调栈 题意看了半天... #include <cstdio> #include <cstdlib> #include <cmath> #include <cstring> #include <string> #include <algorithm> #include <iostream> using namespace std; #define ll long long ; const int inf=1e9; int…
题目链接:http://codeforces.com/contest/845 A. Chess Tourney 水题,排序之后判断第n个元素和n+1个元素是不是想等就可以了. #include <bits/stdc++.h> using namespace std; int a[210]; int n; int main() { scanf("%d", &n); for(int i=1; i<=2*n; i++) scanf("%d", &…
A. Chess Tourney   Berland annual chess tournament is coming! Organizers have gathered 2·n chess players who should be divided into two teams with n people each. The first team is sponsored by BerOil and the second team is sponsored by BerMobile. Obv…
期末后恢复性训练,结果完美爆炸... A,题意:2n个人,分成两队,要求无论怎么分配,第一队打赢第二队 #include<bits/stdc++.h> #define fi first #define se second #define mp make_pair #define pb push_back #define pi acos(-1.0) #define ll long long #define mod 1000000007 #define C 0.5772156649 #define…
F. Guards In The Storehouse time limit per test 1.5 seconds memory limit per test 512 megabytes input standard input output standard output Polycarp owns a shop in the capital of Berland. Recently the criminal activity in the capital increased, so Po…
Educational Codeforces Round 117 (Rated for Div. 2) A. Distance https://codeforces.com/contest/1612/problem/A 题目给出的条件是 距离为曼哈顿距离,而曼哈顿距离等价于步长. 由题目的一半条件,可以得到步长和为AB步长,各自步长为AB步长的一半. 所以显然可以推出: \[1.如果和为奇数则,不存在\\ 2.如果都为偶数,显然只需要取步长一半即可\\ \] //原始代码 #include<bi…
[Educational Codeforces Round 16]E. Generate a String 试题描述 zscoder wants to generate an input file for some programming competition problem. His input is a string consisting of n letters 'a'. He is too lazy to write a generator so he will manually ge…
[Educational Codeforces Round 16]D. Two Arithmetic Progressions 试题描述 You are given two arithmetic progressions: a1k + b1 and a2l + b2. Find the number of integers x such that L ≤ x ≤ R andx = a1k' + b1 = a2l' + b2, for some integers k', l' ≥ 0. 输入 Th…
[Educational Codeforces Round 16]C. Magic Odd Square 试题描述 Find an n × n matrix with different numbers from 1 to n2, so the sum in each row, column and both main diagonals are odd. 输入 The only line contains odd integer n (1 ≤ n ≤ 49). 输出 Print n lines…
[Educational Codeforces Round 16]B. Optimal Point on a Line 试题描述 You are given n points on a line with their coordinates xi. Find the point x so the sum of distances to the given points is minimal. 输入 The first line contains integer n (1 ≤ n ≤ 3·105)…