传送门 https://www.cnblogs.com/violet-acmer/p/10163375.html 题意: 给出串是多态的定义“长度为 n 的串 s ,当串 s 中所有字母出现的次数严格 ≤ n/2,就称此串是多态的”. 求某串 s 是否含有多态的字串,如果含有,输出"YES",并输出此串,反之,输出"NO". 题解: 开局连 wa 五发,读错题意了,难受. 比赛时提交的代码是暴力过的,就是判断长度为 len 的字串是否为多态串,枚举所有可能. 用了树…
http://codeforces.com/contest/1073 A. Diverse Substring #include <bits/stdc++.h> using namespace std; #define ll long long #define minv 1e-6 #define inf 1e9 #define pi 3.1415926536 #define nl 2.7182818284 ; ; char s[maxn]; int main() { int n,i; scan…
浪在ACM 集训队第十次测试赛 A Diverse Substring B Vasya and Books C Birthday D LCM A 传送门 题解 B 传送门 题解: 这道题,就比较简单了,直接用队列模拟一下就好了,话不多说,上代码: #include<iostream> #include<cstdio> #include<cstring> using namespace std; #define mem(a,b) memset(a,b,sizeof(a)…
写之前,先发表下感慨:好久没写题解了,也许是因为自己越来越急利了,也可以说是因为越来越懒了. A. Diverse Substring 直接找一找有没有相邻的两个不同的字符即可. B. Vasya and Books 分别记录书本摆放顺序$a[]$,取书顺序$b[]$,每本书的位置$pos[]$,每本书在不在书堆上$in[]$,书堆最顶端的书的位置$top$(因为用的是数组,元素位置是固定的). 然后,按照题意枚举输入的取书顺序$b[]$,同时记录答案$ans$,更新$top$即可. C. Va…
After I read the solution to the problem, I found that my solution was simply unsightly. Solved 4 out of 7, and my solution to C was hacked, because of my incorrect order when i meet in the middle. I wasted about 20 mins on problem A due to the incom…
这场比赛没有打,后来补了一下,第五题数位dp好不容易才搞出来(我太菜啊). 比赛传送门:http://codeforces.com/contest/1073 A. Diverse Substring 题意:给你个字符串,让你找一个子串满足任意一个字符的个数不超过其他字符的总和,输出yes或no表示否存在,如果存在输出任意一个. 这题只要找两个不同的相邻字符,因为两个字符各一个都不超过其他字符的总和,如果字符串只由一个字符组成或长度等于一才会不存在. 代码如下: #include <iostrea…