[题目链接] http://codeforces.com/contest/430/problem/B [题目大意] 祖玛游戏,给出一个序列,表示祖玛球的颜色序列,三个或者以上的球碰在一起就会发生消除,现在有一个颜色为x的球,问最多可以消除多少球. [题解] 消除的球一定是连续的一段,因此我们可以枚举球射入的位置,然后向两边扩展,每次在已扩展的序列两边有三个相同颜色的球才能继续扩展,否则就停止,取每次枚举的最大值就是答案. [代码] #include <cstdio> #include <…
E. Maximize! time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output You are given a multiset S consisting of positive integers (initially empty). There are two kind of queries: Add a positive int…
Codeforces 828B Black Square(简单题) Description Polycarp has a checkered sheet of paper of size n × m. Polycarp painted some of cells with black, the others remained white. Inspired by Malevich's "Black Square", Polycarp wants to paint minimum pos…
题目描述: Maximum Value time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You are given a sequence a consisting of n integers. Find the maximum possible value of (integer remainder of *a**i* divi…
题目链接:http://codeforces.com/problemset/problem/215/B Description The World Programming Olympics Medal is a metal disk, consisting of two parts: the first part is a ring with outer radius of r1 cm, inner radius of r2 cm, (0 < r2 < r1) made of metal wi…
https://codeforces.com/problemset/problem/993/b 这题不难,暴力就能过,主要是题意太难懂了 题意: 现在有两个人,每个人手中有一对数,第一个人手中的数是n组数中的一对,第二个人手中的数是m组数中的一对 如果这两组数中只有一个数字相等,这该数为共享数字,怎样输出看思路吧 思路: 其实就是n对和m对数中,找共享数字,直接看样例吧: 在第一示例中,第一参与者通信对(1,2)和(3,4),第二参与者通信对(1,5),(3,4).因为我们知道,他们收到的实际对…
Codeforces 题目传送门 & 洛谷题目传送门 首先看到这样的题我们不妨从最特殊的情况入手,再逐渐推广到一般的情况.考虑如果没有特殊点的情况,我们将每个可能的局面看作一个点 \((a,b)\) 并映射到坐标系上.考虑按照博弈论的套路求出每个点是必胜点还是必输点,就这题而言,显然一个点 \((x,y)\) 是必胜点当且仅当 \(\exists z<x\) 满足 \((z,y)\) 是必胜点或者 \(\exists z<y\) 满足 \((y,z)\) 是必胜点.打个表 即可知道一个…
比赛传送门 A. Make a triangle! 题目大意:给你三根木棒,选出其中一根木棒增加它的长度,使构成三角形,问增加的长度最小是多少. 思路:签到题,根据样例/三角形性质不难发现,答案就是最长边减剩下两边之和加一. #include<cstdio> #include<algorithm> using namespace std; ]; int main() { ;i<=;i++) scanf("%d",&seq[i]); sort(seq…
Let's call the following process a transformation of a sequence of length nn. If the sequence is empty, the process ends. Otherwise, append the greatest common divisor (GCD) of all the elements of the sequence to the result and remove one arbitrary e…
题目描述: Problem Description An array of positive integers a1, a2, ..., an is given. Let us consider its arbitrary subarray al, al + 1..., ar, where 1 ≤ l ≤ r ≤ n. For every positive integer s denote by Ks the number of occurrences of s into the subarra…