Codeforces Round #792 (Div. 1 + Div. 2) A-E A 题目 https://codeforces.com/contest/1684/problem/A 题解 思路 知识点:数学. 显然长度大于等于3的数字串的最小数位是完全可以通过这些操作留到最后. 长度等于2的数字串只可能是个位数字. 时间复杂度 \(O(n)\) 空间复杂度 \(O(n)\) 代码 #include <bits/stdc++.h> using namespace std; int mai…
比赛链接:Dashboard - Codeforces Round #792 (Div. 1 + Div. 2) - Codeforces C. Column Swapping 题意: 给定一个n*m大小的二维数组,要求只进行一次两列交换,使得得到的新数组的每行都是不减的.特别的,允许交换的两列是相同列. 思路:构造 可以考虑复制一份数组,并将其排序,那么两个数组中出现数字大小不同的列就是需要进行交换的列. 设需要交换的列的数量为num: ◇ 当num=0,无需交换,可以直接选择交换1 1.◇…
Problem   Educational Codeforces Round 60 (Rated for Div. 2) - C. Magic Ship Time Limit: 2000 mSec Problem Description Input Output The only line should contain the minimal number of days required for the ship to reach the point (x2,y2)(x2,y2). If it…
Problem   Educational Codeforces Round 60 (Rated for Div. 2) - D. Magic Gems Time Limit: 3000 mSec Problem Description Input The input contains a single line consisting of 2 integers N and M (1≤N≤10^18, 2≤M≤100). Output Print one integer, the total n…
Educational Codeforces Round 43 (Rated for Div. 2) https://codeforces.com/contest/976 A #include<bits/stdc++.h> using namespace std; #define lson l,mid,rt<<1 #define rson mid+1,r,rt<<1|1 #define IT set<ll>::iterator #define sqr(x)…
Educational Codeforces Round 35 (Rated for Div. 2) https://codeforces.com/contest/911 A 模拟 #include<bits/stdc++.h> using namespace std; #define lson l,mid,rt<<1 #define rson mid+1,r,rt<<1|1 #define IT set<ll>::iterator #define sqr(…
Codeforces Educational Codeforces Round 44 (Rated for Div. 2) F. Isomorphic Strings 题目连接: http://codeforces.com/contest/985/problem/F Description You are given a string s of length n consisting of lowercase English letters. For two given strings s an…
Codeforces Educational Codeforces Round 44 (Rated for Div. 2) E. Pencils and Boxes 题目连接: http://codeforces.com/contest/985/problem/E Description Mishka received a gift of multicolored pencils for his birthday! Unfortunately he lives in a monochrome w…
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 39 (Rated for Div. 2) G 题意: 给一个序列\(a_i(1 <= a_i <= 10^{9}),2 <= n <= 200000\), 如果至多删除其中的一个数之后该序列为严格上升序列,那么称原序列为几乎严格上升序列. 现在每次将序列中的任意数字变成任意数字,问最少要操作几次才能将序列变成几乎严格上升子序列. 思路: 如果不考虑删除,求让整个序列都变成严格上升子序列的次数 求出\(序列a_i - i\)…