[题目] B. Lost Array [描述] Bajtek有一个数组x[0],x[1],...,x[k-1]但被搞丢了,但他知道另一个n+1长的数组a,有a[0]=0,对i=1,2,...,n.由此可以找到数组x[0],x[1],...,x[k-1]的一些可能情况,即满足这个关系的数组x[0],x[1],...,x[k-1].问一共有多少种可能的数组x[0],x[1],...,x[k-1]的长度k,输出可能的数量以及所有可能的长度k. 数据范围:1<=n<=1000,1<=a[i]&l…
[题目] D. Mysterious Crime [描述] 有m个n排列,求一共有多少个公共子段. 数据范围:1<=n<=100000,1<=m<=10 [思路] 对于第一个排列来说,如果第k个位置开始往后L长的子段是一个公共的子段,那么从k开始往后数1,2,...,L-1长的子段都是公共的子段:如果第k个位置开始往后L长的子段是一个公共的子段,但第k个位置开始往后L+1长的子段不是一个公共的子段,那么位置k到位置k+L中任一位置j开始往后直到位置k+L的子段都不是公共的子段.这就…
[题目] C. Smallest Word [描述] IA有一个由若干个'a'和'b'组成的字符串,IA可以翻转该字符串的任意长的前缀,IA想通过这样的操作得到一个字典序最小的字符串,求一种可能的翻转方案.输出是否翻转长度为k的前缀,k=1,2,...,n,n为该字符串长度. 数据范围:1<=字符串长度<=1000 [思路] 为了把第m+1个字符挪到第1个位置并保持其他字符不动,可以翻转m长的和m+1长的前缀(先后顺序不影响结果).于是,我们可以通过这样的操作把每一个'a'挪到最前面,最后就得…
[题目] A. Elections [描述] Awruk和Elodreip参加选举,n个人投票,每个人有k张票,第i个人投a[i]张票给Elodreip,投k-a[i]张票给Awruk.求最小的k,使得Awruk比Elodreip得票多. 数据范围:1<=n<=100,1<=a[i]<=100 [思路] Awruk得票数为n*k-(a[1]+...+a[n]),Elodreip得票数为a[1]+...+a[n].n*k-(a[1]+...+a[n])>a[1]+...+a[n…
开个新号打打codeforces(以前那号玩废了),结果就遇到了这么难一套.touristD题用了map,被卡掉了(其实是对cf的评测机过分自信),G题没过, 700多行代码,码力惊人.关键是这次tourist掉到第二了,掉了200多分,为神节哀. 做了4道,要不是第4题一直炸第5题也能做出来.本来想着上蓝名的.然后我第二题挂了,判断循环节写错了.绝望啊---- 比赛传送门:http://codeforces.com/contest/1043 A. Elections 这题很简单,就是说有n个人…
Codeforces Round #519 by Botan Investments #include<bits/stdc++.h> #include<iostream> #include<cstdio> #include<cstdlib> #include<cstring> #include<cmath> #include<algorithm> #include<queue> #include<vect…
Educational Codeforces Round 63 (Rated for Div. 2) D. Beautiful Array time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given an array aa consisting of nn integers. Beauty of array i…
Codeforces Round #549 (Div. 2) B. Nirvana [题目描述] B. Nirvana time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Kurt reaches nirvana when he finds the product of all the digits of some positive int…
A. Elections 题意概述 给出 \(a_1, \ldots, a_n\),求最小的 \(k (k \ge \max a_i)\), 使得 \(\sum_{i=1}^n a_i < \sum_{i=1}^n (k-a_i)\) 原题链接 解题思路 数据范围小,直接枚举就好了 代码 #include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); int n; cin &g…
[链接] 我是链接,点我呀:) [题意] [题解] 枚举k 不难根据a得到x[0..k-1] 然后再根据a[k+1..n]来验证一下得到的x是否正确就好. [代码] #include <bits/stdc++.h> #define rep1(i,a,b) for (int i = a;i <= b;i++) #define rep2(i,a,b) for (int i = a;i >= b;i--) using namespace std; const int N = 1000;…