B. Restoring Painting 题目连接: http://www.codeforces.com/contest/675/problem/B Description Vasya works as a watchman in the gallery. Unfortunately, one of the most expensive paintings was stolen while he was on duty. He doesn't want to be fired, so he h…
A. Infinite Sequence 题目连接: http://www.codeforces.com/contest/675/problem/A Description Vasya likes everything infinite. Now he is studying the properties of a sequence s, such that its first element is equal to a (s1 = a), and the difference between…
Beru-taxi 题目链接: http://codeforces.com/contest/706/problem/A Description Vasiliy lives at point (a, b) of the coordinate plane. He is hurrying up to work so he wants to get out of his house as soon as possible. New app suggested n available Beru-taxi…
A. Uncowed Forces Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/604/problem/A Description Kevin Sun has just finished competing in Codeforces Round #334! The round was 120 minutes long and featured five problems with maxi…
题目链接:http://codeforces.com/contest/675/problem/C 给你n个bank,1~n形成一个环,每个bank有一个值,但是保证所有值的和为0.有一个操作是每个相邻的bank之间可以转钱,让你用最少的操作使每个bank的值为0. 一开始没什么思路,看了一下别人的题解,果然还是还是native... 要是让操作次数变少,首先划分和为0的区间个数要尽量多,比如一个区间的长度为k,那么他操作次数为k - 1,所以总的操作次数就是(n - 区间的个数). 那么要算出区…
A. Wizards' Duel Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/591/problem/A Description Harry Potter and He-Who-Must-Not-Be-Named engaged in a fight to the death once again. This time they are located at opposite ends of…
A. LCM Challenge 题目连接: http://www.codeforces.com/contest/235/problem/A Description Some days ago, I learned the concept of LCM (least common multiple). I've played with it for several times and I want to make a big number with it. But I also don't wa…
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…
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. Two Substrings Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/550/problem/A Description You are given string s. Your task is to determine if the given string s contains two non-overlapping substrings "AB" and "…
A. Even Odds Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/318/problem/A Description Being a nonconformist, Volodya is displeased with the current state of things, particularly with the order of natural numbers (natural n…
A. Two Bases Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/602/problem/A Description After seeing the "ALL YOUR BASE ARE BELONG TO US" meme for the first time, numbers X and Y realised that they have different bases,…
A. Calculating Function Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/486/problem/A Description For a positive integer n let's define a function f: f(n) =  - 1 + 2 - 3 + .. + ( - 1)nn Your task is to calculate f(n) for a…
A. Lineland MailTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/567/problem/A Description All cities of Lineland are located on the Ox coordinate axis. Thus, each city is associated with its position xi — a coordinate on th…
B. Luxurious Houses Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/581/problem/B Description The capital of Berland has n multifloor buildings. The architect who built up the capital was very creative, so all the houses wer…
A. Multiplication Table Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/577/problem/A Description Let's consider a table consisting of n rows and n columns. The cell located at the intersection of i-th row and j-th column co…
C. NP-Hard Problem 题目连接: http://www.codeforces.com/contest/688/problem/C Description Recently, Pari and Arya did some research about NP-Hard problems and they found the minimum vertex cover problem very interesting. Suppose the graph G is given. Subs…
B. Lovely Palindromes 题目连接: http://www.codeforces.com/contest/688/problem/B Description Pari has a friend who loves palindrome numbers. A palindrome number is a number that reads the same forward or backward. For example 12321, 100001 and 1 are palin…
B. Economy Game 题目连接: http://www.codeforces.com/contest/681/problem/B Description Kolya is developing an economy simulator game. His most favourite part of the development process is in-game testing. Once he was entertained by the testing so much, th…
A. Summer Camp 题目连接: http://www.codeforces.com/contest/672/problem/A Description Every year, hundreds of people come to summer camps, they learn new algorithms and solve hard problems. This is your first year at summer camp, and you are asked to solv…
B. Qualifying Contest 题目连接: http://www.codeforces.com/contest/659/problem/B Description Very soon Berland will hold a School Team Programming Olympiad. From each of the m Berland regions a team of two people is invited to participate in the olympiad.…
Break the Chocolate Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/546/problem/A Description A soldier wants to buy w bananas in the shop. He has to pay k dollars for the first banana, 2k dollars for the second one and so…
B. Equidistant String Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/545/problem/B Description Little Susie loves strings. Today she calculates distances between them. As Susie is a small girl after all, her strings conta…
 A. Toy Cars Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/545/problem/A Description Little Susie, thanks to her older brother, likes to play with cars. Today she decided to set up a tournament between them. The process…
B. Print Check 题目连接: http://www.codeforces.com/contest/631/problem/B Description Kris works in a large company "Blake Technologies". As a best engineer of the company he was assigned a task to develop a printer that will be able to print horizon…
#include<stdio.h> #include<iostream> #include<memory.h> #include<math.h> using namespace std; ]; ]; ]; int main() { memset(flag1,,sizeof(flag1)); memset(flag2,,sizeof(flag2)); memset(flag3,,sizeof(flag3)); int n; cin>>n; ,kis…
A. Far Relative's Birthday Cake 题意: 求在同一行.同一列的巧克力对数. 分析: 水题~样例搞明白再下笔! 代码: #include<iostream> using namespace std; const int maxn = 105; char a[maxn][maxn]; int main (void) { int N;cin>>N; int cnt = 0, res = 0; for(int i = 0; i < N; i++){ cn…
B. PIN Codes A PIN code is a string that consists of exactly 4 digits. Examples of possible PIN codes: 7013, 0000 and 0990. Please note that the PIN code can begin with any digit, even with 0. Polycarp has n (2≤n≤10) bank cards, the PIN code of the i…
A. Sweet Problem the first pile contains only red candies and there are r candies in it, the second pile contains only green candies and there are g candies in it, the third pile contains only blue candies and there are b candies in it. Each day Tany…
A. Integer Points DLS and JLS are bored with a Math lesson. In order to entertain themselves, DLS took a sheet of paper and drew…