【题解】Educational Codeforces Round 82】的更多相关文章

A. Erasing Zeroes (模拟) #include<bits/stdc++.h> using namespace std; typedef long long ll; ; int main(){ int t;cin>>t; while(t--){ string s;cin>>s; ,f2 = ; ; ; ;i<s.length();i++){ '){ ) { ans+=cnt; cnt = ; f1 = ; } ) f1 = ; } else{ ) c…
比较菜只有 A ~ E A.Erasing Zeroes 题目描述: 原题面 题目分析: 使得所有的 \(1\) 连续也就是所有的 \(1\) 中间的 \(0\) 全部去掉,也就是可以理解为第一个 \(1\) 到最后一个 \(1\) 中间的 \(0\) 全部去掉,也就是它们之间 \(0\) 的个数,那么就顺序.逆序扫一遍就出来了. 代码详解: 点击查看代码 #include<bits/stdc++.h> using namespace std; int main(){ int t; cin&g…
题外话 开始没看懂D题意跳了,发现F题难写又跳回来了.. 语文好差,码力好差 A 判第一个\(1\)跟最后一个\(1\)中\(0\)的个数即可 B 乘乘除除就完事了 C 用并查集判一下联通,每个联通块内必须为一条链 E 枚举\(t\)串的断点,然后\(f_{i,j}\)表示匹配到s串的第\(i\)个,\(t\)串的第一节的第\(j\)个时\(t\)串第二节最大匹配位置 F \(O(cnm)\) 离线下来每个\(c\)块,设查询区间为\([l,r]\),处理出\(r\)的答案,倒序判将某个位置\(…
#define HAVE_STRUCT_TIMESPEC #include<bits/stdc++.h> using namespace std; ],t[]; int n,m; ][];//nex[i][j]表示i位置以字母j+'a'最先出现的位置 ][];//把t分割为t1和t2,dp[i][j]表示t1长度为i,t2长度为j时,在字符串s中的最小位置 int check(int x){ int y=m-x; dp[][]=; ;i<=x;++i) ;j<=y;++j){ &a…
从低位到高位枚举,当前位没有就去高位找到有的将其一步步拆分,当前位多余的合并到更高一位 #define HAVE_STRUCT_TIMESPEC #include<bits/stdc++.h> using namespace std; ]; ],num[]; int main(){ ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int t; cin>>t; while(t--){ memset(sum,,si…
Polycarp wants to assemble his own keyboard. Layouts with multiple rows are too complicated for him — his keyboard will consist of only one row, where all 2626 lowercase Latin letters will be arranged in some order. Polycarp uses the same password ss…
Your company was appointed to lay new asphalt on the highway of length nn. You know that every day you can either repair one unit of the highway (lay new asphalt over one unit of the highway) or skip repairing. Skipping the repair is necessary becaus…
You are given a string ss. Each character is either 0 or 1. You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 1…
A. Erasing Zeroes Description You are given a string \(s\). Each character is either 0 or 1. You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegm…
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…