D. Name That Tune time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output It turns out that you are a great fan of rock band AC/PE. Peter learned that and started the following game: he plays the f…
D. Bad Luck Island Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/540/problem/D Description The Bad Luck Island is inhabited by three kinds of species: r rocks, s scissors and p papers. At some moments of time two random i…
B. Name That Tune time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output It turns out that you are a great fan of rock band AC/PE. Peter learned that and started the following game: he plays the f…
题目链接: http://codeforces.com/problemset/problem/148/D D. Bag of mice time limit per test2 secondsmemory limit per test256 megabytes 问题描述 The dragon and the princess are arguing about what to do on the New Year's Eve. The dragon suggests flying to the…
D. Ilya and Escalator time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Ilya got tired of sports programming, left university and got a job in the subway. He was given the task to determine…
                                                                               D. Painting The Wall   User ainta decided to paint a wall. The wall consists of n2 tiles, that are arranged in an n × n table. Some tiles are painted, and the others are n…
E. Hyakugoku and Ladders Hyakugoku has just retired from being the resident deity of the South Black Snail Temple in order to pursue her dream of becoming a cartoonist. She spent six months in that temple just playing "Cat's Cradle" so now she w…
Codeforces Round #267 (Div. 2) C. George and Job题目链接请点击~ The new ITone 6 has been released recently and George got really keen to buy it. Unfortunately, he didn't have enough money, so George was going to work as a programmer. Now he faced the follow…
A. Watching a movie time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You have decided to watch the best moments of some movie. There are two buttons on your player: Watch the current minute…
题目链接:http://codeforces.com/contest/499 A. Watching a movie You have decided to watch the best moments of some movie. There are two buttons on your player: Watch the current minute of the movie. By pressing this button, you watch the current minute of…
A. Crazy Town 题目连接: http://codeforces.com/contest/498/problem/A Description Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The r…
题目链接: http://codeforces.com/problemset/problem/498/C C. Array and Operations time limit per test1 secondmemory limit per test256 megabytes 问题描述 You have written on a piece of paper an array of n positive integers a[1], a[2], ..., a[n] and m good pair…
题目地址 简要题意: 给出两个点的坐标,以及一些一般直线方程Ax+B+C=0的A.B.C,这些直线作为街道,求从一点走到另一点需要跨越的街道数.(两点都不在街道上) 思路分析: 从一点到另一点必须要跨的街道等价于两点一点在这条直线一侧,另一条在另一侧.只需要将两点坐标带进去,一正一负即可.将这些直线依次检验,统计总和. #include<stdio.h> #include<bits/stdc++.h> #include <iostream> using namespac…
A. Crazy Town 这一题只需要考虑是否经过所给的线,如果起点和终点都在其中一条线的一侧,那么很明显从起点走点终点是不需要穿过这条线的,否则则一定要经过这条线,并且步数+1.用叉积判断即可. 代码: #include<cstdio> #include<cstring> #include<algorithm> #include<string> #include<map> #define N 100010 #define M 1010 usi…
因为只有奇偶之间有操作, 可以看出是二分图, 然后拆质因子, 二分图最大匹配求答案就好啦. #include<bits/stdc++.h> #define LL long long #define fi first #define se second #define mk make_pair #define PLL pair<LL, LL> #define PLI pair<LL, int> #define PII pair<int, int> #defin…
解题思路:给出 n个电影的精彩时段(a[i],b[i]),和每次可以跳过的时间x,问要看完所有的精彩时刻,至少需要看多长时间的电影. 因为要时间最少,所有除了精彩时刻的电影则能跳过就跳过(用取余来算),不能跳过则加到耗费的总时间里面. 反思:WA两次是因为没有搞清楚物理上的时刻和时间的关系, -------------------------------------------------- 1    2     3     4      5      6       7       8 如果我…
C. Famil Door and Brackets 题目连接: http://www.codeforces.com/contest/629/problem/C Description As Famil Door's birthday is coming, some of his friends (like Gabi) decided to buy a present for him. His friends are going to buy a string consisted of roun…
题目链接: http://codeforces.com/problemset/problem/208/C C. Police Station time limit per test:2 secondsmemory limit per test:256 megabytes 问题描述 The Berland road network consists of n cities and of m bidirectional roads. The cities are numbered from 1 to…
B. Let's Play Osu! 题目连接: http://www.codeforces.com/contest/235/problem/B Description You're playing a game called Osu! Here's a simplified version of it. There are n clicks in a game. For each click there are two outcomes: correct or bad. Let us deno…
C. Chain Reaction 题目连接: http://www.codeforces.com/contest/608/problem/C Description There are n beacons located at distinct positions on a number line. The i-th beacon has position ai and power level bi. When the i-th beacon is activated, it destroys…
题目:https://codeforces.com/problemset/problem/977/F 题意:一个序列,求最长单调递增子序列,但是有一个要求是中间差值都是1 思路:dp,O(n)复杂度,我们想一下O(n^2)时的最长递增子序列,我们第二个循环要遍历前面所有的如果大于长度就加1,代表以这个数结尾的最长长度是多少, 因为中间差值不定,所以我们遍历整个循环,这个题设置中间差值只能是1,所以我们递推式就可以是   dp[i]=max(dp[i],dp[i-1]+1),用map来映射值即可…
C. Mahmoud and a Message 题目连接: http://codeforces.com/contest/766/problem/C Description Mahmoud wrote a message s of length n. He wants to send it as a birthday present to his friend Moaz who likes strings. He wrote it on a magical paper but he was su…
题目链接: http://codeforces.com/problemset/problem/621/E E. Wet Shark and Blocks time limit per test2 secondsmemory limit per test256 megabytes 问题描述 There are b blocks of digits. Each one consisting of the same n digits, which are given to you in the inp…
题目链接: http://codeforces.com/problemset/problem/337/D D. Book of Evil time limit per test2 secondsmemory limit per test256 megabytes 问题描述 Paladin Manao caught the trail of the ancient Book of Evil in a swampy area. This area contains n settlements num…
C. Gerald and Giant Chess Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/559/problem/C Description Gerald got a very curious hexagon for his birthday. The boy found out that all the angles of the hexagon are equal to . The…
http://codeforces.com/contest/754/problem/C C. Vladik and chat time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Recently Vladik discovered a new entertainment — coding bots for social netwo…
任意门:http://codeforces.com/contest/1114/problem/D D. Flood Fill time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given a line of nn colored squares in a row, numbered from 11 to nn f…
D. Brand New Problem 题目连接: http://www.codeforces.com/contest/201/problem/D Description A widely known among some people Belarusian sport programmer Lesha decided to make some money to buy a one square meter larger flat. To do this, he wants to make a…
链接: https://codeforces.com/contest/1272/problem/D 题意: You are given an array a consisting of n integers. You can remove at most one element from this array. Thus, the final length of the array is n−1 or n. Your task is to calculate the maximum possib…
链接: https://codeforces.com/contest/1215/problem/B 题意: You are given a sequence a1,a2,-,an consisting of n non-zero integers (i.e. ai≠0). You have to calculate two following values: the number of pairs of indices (l,r) (l≤r) such that al⋅al+1-ar−1⋅ar…