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…
题目链接: 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…
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…
Codeforces Round #275 (Div. 1)A. Diverse Permutation Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/482/problem/A Description Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct posi…
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…
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…
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…
水 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…
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…
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…
                                                                                           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…
                                                               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…
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…
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 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…
C. K-special Tables 题目连接: http://www.codeforces.com/contest/625/problem/C Description People do many crazy things to stand out in a crowd. Some of them dance, some learn by heart rules of Russian language, some try to become an outstanding competitiv…
D. The table 题目连接: http://www.codeforces.com/contest/226/problem/D Description Harry Potter has a difficult homework. Given a rectangular table, consisting of n × m cells. Each cell of the table contains the integer. Harry knows how to use two spells…
C. Harmony Analysis 题目连接: http://www.codeforces.com/contest/610/problem/C Description The semester is already ending, so Danil made an effort and decided to visit a lesson on harmony analysis to know how does the professor look like, at least. Danil…
D. Regular Bridge Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/550/problem/D Description An undirected graph is called k-regular, if the degrees of all its vertices are equal k. An edge of a connected graph is called a b…
A. 24 Game Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/468/problem/A Description 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 ha…
B. School Marks Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/540/problem/B Description Little Vova studies programming in an elite school. Vova and his classmates are supposed to write n progress tests, for each test the…
原题链接:http://codeforces.com/contest/584/problem/A 题意: 给你n和t,让你构造一个长度为n的数,并且被t整除 题解: 方法很多,可以乱构造.....不过需要特判n=1且t=10这种特殊情况 代码: #include<iostream> #include<cstring> using namespace std; int t,n; int main() { cin >> n >> t; && t…
链接: https://codeforces.com/contest/1265/problem/D 题意: An integer sequence is called beautiful if the difference between any two consecutive numbers is equal to 1. More formally, a sequence s1,s2,-,sn is beautiful if |si−si+1|=1 for all 1≤i≤n−1. Trans…
这道题不错,思维上不难想到规律,但是如何写出优雅的代码比较考功力. 首先第一个人的序号可以确定,那么接下来所有奇数位的序号就可以一个连一个的确定了.然后a[i].first==0时的a[i].secod就是第二个人的序号,然后偶数位的序号也可以一个连一个的确定了. 用一个next数组,其下标就是a[i].first,其值就是a[i].second,这样巧妙地使用数组下标就解决了“串链子”这个难点,我之前想的每次用二分来找真是弱爆了.. 而在找第一个人的序号时也是妙用flag数组下标. #incl…
B. Mahmoud and Ehab and the bipartiteness time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Mahmoud and Ehab continue their adventures! As everybody in the evil land knows, Dr. Evil likes bi…
题目链接:G. New Roads 题意:给出n个结点,t层深度,每层有a[i]个结点,总共有k个叶子结点,构造一棵树. 分析: 考虑一颗树,如果满足每层深度上有a[i]结点,最多能有多少叶子结点 那么答案很简单,就是对(a[i]-1)求和再加1(每一层的结点都集中在上一层的一个结点上)   同理,我们考虑最少能有多少叶子结点,就是把上一个的答案再减去min(a[i]-1, a[i-1]-1)的求和,就是每一层的结点都尽可能的分散在上一层的结点 根据这个,那么如果要求有k个叶子节点,k在最大值与…
C. Median Smoothing   A schoolboy named Vasya loves reading books on programming and mathematics. He has recently read an encyclopedia article that described the method of median smoothing (or median filter) and its many applications in science and e…