Educational Codeforces Round 29(6/7)】的更多相关文章

1.Quasi-palindrome 题意:问一个字符串(你可以添加前导‘0’或不添加)是否是回文串 思路:将给定的字符串的前缀‘0’和后缀‘0’都去掉,然后看其是否为回文串 #include<iostream> using namespace std; int main() { int num; scanf("%d", &num); != && num % == ) num /= ; ; int tnum = num; while (tnum) {…
A .Regular Bracket Sequence 题意:给定“((” , “()” ,  “)(”,  “))”四种,问是否可以组成合法括号匹配 思路:设四种是ABCD,B可以不用管,而C在A或者D存在时可以不考虑,然后就是A=D. #include<bits/stdc++.h> #define ll long long #define rep(i,a,b) for(int i=a;i<=b;i++) using namespace std; ; ll A,B,C,D,ans; i…
题目 传送门:QWQ A:Codehorses T-shirts 题意: 给定一些字符串表示去年和今年的衣服型号大小( XL XXL M...... ),要求用最少的次数把去年的衣服大小改成今年需要的.每次改动只能更改字符,不能增添字符. 分析: 把今年和去年的型号字典序排一下.然后用挨个对上(因为题目保证合法,所以长度一样的数量必定相等).在字符串长度是1的时候要暴力匹配一下,因为长度为1时有L S M三种东西. 代码: #include <bits/stdc++.h> using name…
题目链接:https://codeforces.com/contest/1155/problem/D 题意:给定n个数,可以选择一段连续子段将其乘x,也可以不操作,求最大连续子段和. 思路:比赛时觉得是dp,但怎么也想不出来QAQ,dp太难了...赛后看了别人题解,找到状态和转移方程就很简单了,然而比赛时我就是想不到... 考虑下标i:有3种情况,可能[0,i]都没有乘x,可能i乘了x,可能[i,n]都不会乘x.分别用dp[i][0]表示以i结尾的最长子段和且 [0,i]都没乘x,dp[i][1…
C News Distribution 并查集水题 D Bicolored RBS 括号匹配问题,如果给出的括号序列nesting depth为n,那么最终可以分成两个nesting depth为n / 2的序列. 在进行匹配的时候,如果当前栈中的左括号大于等于 n / 2,那么剩下的括号就要进行标记,最终标记和不标记的分成两个部分. E Range Deleting 对一个序列去掉一个区间范围内的数字,使得剩下的序列是一个非降序的序列. 这题是一道较好的思维题. 首先可以预处理出1到\(pre…
Codeforces Round #581(Div. 2) CF 1204 A. BowWow and the Timetable 题解:发现,$4$的幂次的二进制就是一个$1$后面跟偶数个$0$. 所以暴力判一下就好. Code: #include <bits/stdc++.h> #define N 110 using namespace std; char s[N]; int main() { scanf("%s", s + 1); int n = strlen(s +…
Educational Codeforces Round 64 CodeForces 1156A 题意:1代表圆,2代表正三角形,3代表正方形.给一个只含1,2,3的数列a,ai+1内接在ai内,求总共有多少个交点. 交了好多遍才过.分类讨论一下内接的情况,然后注意到当正方形内接圆形再内接三角形时会有一个点重复,减去即可. code #include<cstdio> ],ans,flag,haha[][]; int main() { scanf("%d",&n);…
A. Buying Torches 题目:http://codeforces.com/contest/1418/problem/A 题解:计算一个公式:1+n*(x-1)=(y+1)*k,求满足该条件的n,很简单的一道题 代码: #include<bits/stdc++.h> using namespace std; typedef long long ll; ll t,x,y,k; int main() { ll i,j; cin>>t; while(t--) { cin>…
B. More Cowbell time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Kevin Sun wants to move his precious collection of n cowbells from Naperthrill to Exeter, where there is actually grass inst…
A. Uncowed Forces time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Kevin Sun has just finished competing in Codeforces Round #334! The round was 120 minutes long and featured five problems w…