Educational Codeforces Round 63 Div. 2】的更多相关文章

A:找到两个相邻字符使后者小于前者即可. #include<bits/stdc++.h> using namespace std; #define ll long long #define inf 1000000010 #define N 300010 char getc(){char c=getchar();while ((c<'A'||c>'Z')&&(c<'a'||c>'z')&&(c<'0'||c>'9')) c=ge…
Educational Codeforces Round 63 (Rated for Div. 2)题解 题目链接 A. Reverse a Substring 给出一个字符串,现在可以对这个字符串进行一次翻转,问是否存在一种方案,可以使得翻转后字符串的字典序可以变小.   这个很简单,贪心下就行了. 代码如下: Code #include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 3e5…
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…
Educational Codeforces Round 63 A 题目大意就不写了. 挺简单的,若果字符本来就单调不降,那么就不需要修改 否则找到第一次下降的位置和前面的换就好了. #include<iostream> #include<cstdio> #include<cctype> #include<algorithm> #include<queue> using namespace std; const int N = 3e5 + 3;…
Educational Codeforces Round 84 (Div. 2) 读题读题读题+脑筋急转弯 = =. A. Sum of Odd Integers 奇奇为奇,奇偶为偶,所以n,k奇偶性要相同. 由求和公式得k个不同奇数组成的最小数为k2,所以n≥k2. #include <bits/stdc++.h> using namespace std; void solve(){ int n,k; cin>>n>>k; if((n-k)%2==0&&…
题目:https://codeforces.com/contest/1155/problem/D 题意:给你n,x,一个n个数的序列,你可以选择一段区间,区间的数都乘以x,然后求出最大字段和 思路: x正数的时候我们就是求出最大字段和然后乘以x即可 x为负数时,我们可以把一段负数乘以x,然后再与之前的正数连接,求出最大字段和,我们想一下 首先并不是直接求出最小字段和就可以的,给出一组样例 10 -1 0 -10 -10 -10 40 -10 -10 20 0 0 答案应该是80,而像上面的做法是…
https://codeforces.com/contest/1155/problem/E 题意 \(f(x)=a_0+a_1x+a_2x^2+...+a_kx^k,k \leq 10,0 \leq a_i < 10^6+3\),每次可以询问一个x,返回\(f(x)mod(10^6+3)\),50次询问以内需要找到x使得 \(f(x) \equiv 0 mod(10^6+3)\) 题解 现未知\(a_0,a_1,...,a_k\),一共k+1个未知数,需要k+1个方程来解,因此只需要询问k+1次…
https://codeforces.com/contest/1155/problem/D 题意 一个n个数的数组\(a[i]\),可以选择连续的一段乘x,求最大连续子序列的值 题解 错误思路:贪心,假如x<0,那么就选择最小的一段乘以x,再求最大连续子序列,因为这一段可能夹着一些很大的正数使得翻转一整段的代价很大,可能单独翻转前半段或者后半段更好 定义\(f[i]\)为以i结尾的最大连续子序列,\(g[i]\)为以i开头的最大连续子序列 假设选择翻转的区间是(l,r),则有\(ans=max(…
题意:博弈题面  给出一个数字序列 (>=11)  有两个人任意删除数字 直到 数字只剩下11位 如果删除后的数字串开头是8那么就是第一个赢 否则就是第二个人赢 第一个人先手  数字序列一定是奇数长度 思路: 首先计算一共走多少步 第二个人想赢只有以下两种方法 想法1:如果第二个人能把8都删掉 那么第二个人肯定赢 想法2: 如果删不掉 那么第二个人肯定从前到后尽可能得删掉8 这样使得第一个人的步数不足删除从前到后 步数+1那个8 的其他字符 否则就是第一人赢,直接模拟即可 (比赛的时候一直WA…
题意:给出一个递增的时间序列a  给出另外一个序列b  (都是整数) 以b中任选一个数字作为间隔  自己从1开始任选一个时间当成开始时间 输出选择的数字标号以及 开始时间 思路  直接求间隔的公共gcd 然后看 给的序列b 中有没有数 b[i]|gcd 即可 如果没有则输出-1 #include<bits/stdc++.h> #define mkp make_pair #define pb push_back #define F first #define S second using nam…