C. Sorting Railway Cars   An infinitely long railway has a train consisting of n cars, numbered from 1 to n (the numbers of all the cars are distinct) and positioned in arbitrary order. David Blaine wants to sort the railway cars in the order of incr…
C. Sorting Railway Cars Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://www.codeforces.com/contest/606/problem/C Description An infinitely long railway has a train consisting of n cars, numbered from 1 to n (the numbers of all the cars are distin…
C. Sorting Railway Cars time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output An infinitely long railway has a train consisting of n cars, numbered from 1 to n (the numbers of all the cars are d…
水 A - Magic Spheres 这题也卡了很久很久,关键是“至少”,所以只要判断多出来的是否比需要的多就行了. #include <bits/stdc++.h> using namespace std; #define lson l, mid, o << 1 #define rson mid + 1, r, o << 1 | 1 typedef long long ll; const int N = 1e5 + 5; const int INF = 0x3f3f…
                                                               C. Sorting Railway Cars time limit per test: 2 seconds memory limit per test: 256 megabytes input: standard input output: standard output An infinitely long railway has a train consisting…
C. Sorting Railway Cars time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output An infinitely long railway has a train consisting of n cars, numbered from 1 to n (the numbers of all the cars are d…
B. Testing Robots Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://www.codeforces.com/contest/606/problem/B Description The Cybernetics Failures (CF) organisation made a prototype of a bomb technician robot. To find the possible problems it was de…
C. Freelancer's Dreams Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://www.codeforces.com/contest/605/problem/C Description Mikhail the Freelancer dreams of two things: to become a cool programmer and to buy a flat in Moscow. To become a cool pro…
D. Lazy Student Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/606/problem/D Description Student Vladislav came to his programming exam completely unprepared as usual. He got a question about some strange algorithm on a gr…
A. Magic Spheres Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://www.codeforces.com/contest/606/problem/A Description Carl is a beginner magician. He has a blue, b violet and c orange magic spheres. In one move he can transform two spheres of the…
题目链接: http://codeforces.com/contest/606/problem/D D. Lazy Student time limit per test2 secondsmemory limit per test256 megabytes 问题描述 Student Vladislav came to his programming exam completely unprepared as usual. He got a question about some strange…
A. Magic Spheres   Carl is a beginner magician. He has a blue, b violet and c orange magic spheres. In one move he can transform two spheres of the same color into one sphere of any other color. To make a spell that has never been seen before, he nee…
D. Lazy Student   Student Vladislav came to his programming exam completely unprepared as usual. He got a question about some strange algorithm on a graph — something that will definitely never be useful in real life. He asked a girl sitting next to…
                                                                                           B. Testing Robots time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output The Cybernetics Failures (CF) o…
题意:p, q,都是整数. sigma(Ai * ki)>= p, sigma(Bi * ki) >= q; ans = sigma(ki).输出ans的最小值 约束条件2个,但是变量k有100000个,所以可以利用对偶性转化为求解 ans = p * y1 + q * y2 约束条件为: Ai * y1 + Bi * y2 <= 1 其中i为0~n-1 也就是n个约束条件. 后面三分搞搞就好了 #include <bits/stdc++.h> using namespace…
B. Testing Robots time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output The Cybernetics Failures (CF) organisation made a prototype of a bomb technician robot. To find the possible problems it w…
A. Magic Spheres time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Carl is a beginner magician. He has a blue, b violet and c orange magic spheres. In one move he can transform two spheres o…
B. Testing Robots time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output The Cybernetics Failures (CF) organisation made a prototype of a bomb technician robot. To find the possible problems it w…
D. Once Again... time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You are given an array of positive integers a1, a2, ..., an × T of length n × T. We know that for any i > n it is true that …
E. Weakness and Poorness time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given a sequence of n integers a1, a2, ..., an. Determine a real number x such that the weakness of the seq…
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…
[Codeforces Round #672 (Div. 2) A - C1 ] 题目链接# A. Cubes Sorting 思路: " If Wheatley needs more than \(\frac{n \cdot (n-1)}{2}-1\) exchange operations, he won't do this boring work." 例如:5,4,3,2,1 我们需要移动4+3+2+1=10次,也就是\(\frac{n \cdot (n-1)}{2}\)次,所以…
Codeforces Round #821(Div.2) (A-C) A.Consecutive Sum 大致题意 给定一组共 n 个数据 ,如果俩个数的下标在 mod k 意义下同余,则可以交换a[I] 和 a[j] ,求操作后一段连续的数的和的最大值. 基本思路 本题属于水题,因为 t 和 n 都比较小,所以可以直接暴力的把所有最大的数移到最前面的 k 个位置,即从最后 k 个数开始向前枚举比较,做冒泡排序即可. 代码 #include<bits/stdc++.h> using names…
Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate it n = int(raw_input()) s = "" a = ["I hate that ","I love that ", "I hate it","I love it"] for i in ran…
Codeforces Round #354 (Div. 2) Problems     # Name     A Nicholas and Permutation standard input/output 1 s, 256 MB    x3384 B Pyramid of Glasses standard input/output 1 s, 256 MB    x1462 C Vasya and String standard input/output 1 s, 256 MB    x1393…
直达–>Codeforces Round #368 (Div. 2) A Brain’s Photos 给你一个NxM的矩阵,一个字母代表一种颜色,如果有”C”,”M”,”Y”三种中任意一种就输出”#Color”,如果只有”G”,”B”,”W”就输出”#Black&White”. #include <cstdio> #include <cstring> using namespace std; const int maxn = 200; const int INF =…
 cf之路,1,Codeforces Round #345 (Div. 2) ps:昨天第一次参加cf比赛,比赛之前为了熟悉下cf比赛题目的难度.所以做了round#345连试试水的深浅.....       其实这个应该是昨天就写完的,不过没时间了,就留到了今天.. 地址:http://codeforces.com/contest/651/problem/A A. Joysticks time limit per test 1 second memory limit per test 256…
Codeforces Round #279 (Div. 2) 做得我都变绿了! Problems     # Name     A Team Olympiad standard input/output 1 s, 256 MB  x2377 B Queue standard input/output 2 s, 256 MB  x1250 C Hacking Cypher standard input/output 1 s, 256 MB  x740 D Chocolate standard in…
Codeforces Round #262 (Div. 2) 1003 C. Present time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Little beaver is a beginner programmer, so informatics is his favorite subject. Soon his info…