传送门:E - RLE (atcoder.jp) 题意: 求满足原长为N且转换后长度严格小于N条件的小写字母组成的字符串的数量,输出时对P取模. 其中,转换规则为,将连续相同的字串替换为"字符数量+字符",如aaa替换为3a. 思路: 状态表示: fi,j:原长为i且转换后长度为j的字符串的数量. 状态转移: 初始化:将仅包含一种字符的所有字符串进行初始化. 转移:先考虑暴力做法:fi,j:考虑最后一段连续相同字串的长度为k,其替换后的字串长度为u,那么fi,j = 25 * ∑ fi…
传送门:F - Keep Connect (atcoder.jp) 题意: 给定长度为N的操作(ti,yi). 给定初值为0的x,对其进行操作:当t为1时,将x替换为y:当t为2时,将x加上y. 最多可以跳过k步,求最终x的最大值. 思路: 注意到,当t为1时,进行替换操作,那么该位置前面的操作是不会对后面产生任何影响的,也就不会消耗k. 那么我们可以枚举最后一次不跳过的1操作,对于该位置的前面无需考虑,对于该位置的后面:所有的1操作都应跳过(记数量为cnt),且对于2操作选择数值前k - cn…
题目大意:给你N个字符串,你可以从中选择任意数量的字符串,请统计在你的字串中,相同字母出现次数正好为K次的字母数.数据保证出现的字母都是小写字母. 1≤N≤15 1 ≤K≤N 一开始读题的时候读错了,读成了至少为k次,就想的暴力选择全部字符串,然后统计字母数,但是在认真读题WA了N发后发现是恰好为K次,所以正确打开方式应该是 用二进制枚举所有选择方案,然后不断更新最大值. 因为每一个字符串在本题中只有两种状态:选(1),不选(0) 所以我们对于所有字符串总共有2^N个方案 我们随意取其中一个例子…
A - Happy Birthday! Time limit : 2sec / Memory limit : 1000MB Score: 100 points Problem Statement E869120's and square1001's 16-th birthday is coming soon.Takahashi from AtCoder Kingdom gave them a round cake cut into 16 equal fan-shaped pieces. E869…
人生第一场 AtCoder,纪念一下 话说年后的 AtCoder 比赛怎么这么少啊(大雾 AtCoder Beginner Contest 154 题解 A - Remaining Balls We have A balls with the string S written on each of them and B balls with the string T written on each of them. From these balls, Takahashi chooses one…
AtCoder Beginner Contest 177 题解 目录 AtCoder Beginner Contest 177 题解 A - Don't be late B - Substring C - Sum of product of pairs D - Friends E - Coprime F - I hate Shortest Path Problem A - Don't be late 问你能不能在时间\(T\)内用不高于\(S\)的速度走过\(D\)的路程,转化为判断\(ST\)…
KYOCERA Programming Contest 2021(AtCoder Beginner Contest 200) 题解 哦淦我已经菜到被ABC吊打了. A - Century 首先把当前年份减去\(1\),对应的世纪也减去\(1\),然后我们就发现第\(0\)到\(99\)年对应第\(0\)世纪,第\(100\)到\(199\)年对应第\(1\)世纪,以此类推. 答案就是\(\lfloor \frac {N-1} {100} \rfloor\).这里\(\lfloor x \rflo…
没看到Beginner,然后就做啊做,发现A,B太简单了...然后想想做完算了..没想到C卡了一下,然后还是做出来了.D的话瞎想了一下,然后感觉也没问题.假装all kill.2333 AtCoder Beginner Contest 052 A题意: 输出大的面积? 思路: max(A*B,C*D); AtCoder Beginner Contest 052 B题意: 枚举过程,然后...太水了.. AtCoder Beginner Contest 052 C题意: 输出N!的因子个数mod1…
A - ABC/ARC Time limit : 2sec / Memory limit : 256MB Score : 100 points Problem Statement Smeke has decided to participate in AtCoder Beginner Contest (ABC) if his current rating is less than 1200, and participate in AtCoder Regular Contest (ARC) oth…
AtCoder Beginner Contest 136 题目链接 A - +-x 直接取\(max\)即可. Code #include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 2e5 + 5; int main() { ios::sync_with_stdio(false); cin.tie(0); int a, b; cin >> a >> b; cout &…