题意:给你一个01串,问其是否能拆成若干形如0101010的子串,若能,输出所有子串的0,1 的位置. 题解:一开是暴力,然后瞎找规律, 最后找到一种神奇的线性构造法:扫一遍字符串,若为0就一直竖着往下写0,碰到1就回头往上写,再碰到0 就回头往下写······判断无法构造的依据:如果写1写得超过了上界就跳出,如果最后写的0不在最下面也跳出//codeforces上看到的一段代码秀的脑壳疼 坑:之前随便找规律,写了个巨丑的代码,逻辑混乱,直接wa掉. 无脑写的直接T了 ac #define _C…
题意 : 给出一个 01 串,要求你将其分隔出若干个子序列 ( 每个数字只能属于某一个子序列 ) ,子序列必须满足由 0 开头和结尾,且中间需 01 交替构成.若无法做到,则输出 -1. 分析 :  很容易想到需要去贪心配对 0 和 1 即 能 01 交替去构造就尽量选择这种方案,这样才能用更少的 0 去配对尽量多的 1 用 vector<int> idx[] 这个二维数组来装各个子序列的信息 使用两个 set 来装现在以 0 结尾以及以 1 结尾的子序列的下标 然后 O(n) 从左到右扫一遍…
遇见模拟题 有两种做法 例如这题: 1.直接去算次数(统计哪个数在第几位,然后去运算) 2.模拟操作 贴一个别人的代码...https://blog.csdn.net/weixin_39453270/article/details/80548780 #include <bits/stdc++.h> using namespace std; const int INF=0x3f3f3f3f; string str1,str2; ; void Get(char a,char b,int n,int…
前面提及到<大话音频变声原理 附简单示例代码>与<声音变调算法PitchShift(模拟汤姆猫) 附完整C++算法实现代码> 都稍微讲过变声的原理和具体实现. 大家都知道,算法从实现到最后工程应用,中间的环节和问题特别多. 尤其是编码的架构设计,好的数据结构和代码逻辑封装肯定是可复用,组件化的. 前几天写完<音频识别算法思考与阶段性小结>的时候, 我也提及到了. 会做一些算法编码优化相关的分享. 而有时候我总觉得文字表达很苍白, 所以我尽可能地把代码写得简洁易懂, 一方…
spring-mvc实现模拟数据到网页展示过程代码 先看看我们的3种模拟数据到网页展示的思路图: 1.当mybatis的环境配置完成.一个动态Web项目建立好.开始导入jar包. -spring的aop,aspects,context,beans,core,expression,jdbc,tx,web,webmvc jar包导入 -log4j 核心包2个 -aopjar包:aopaliance-1.0jar,aspectjweaver-1.8.10jar -jstl.jar,standard.j…
借鉴自: https://www.cnblogs.com/SuuT/p/8619227.html https://blog.csdn.net/my_sunshine26/article/details/79502152 题意: 给定一个01字符串,需要你把它分为k个子序列,其中k可以为任意正整数. 对子序列的要求为 以0开始,以0结束 0,1相间 输出满足条件的一种结果即可.  输出的结果还要从低到高的顺序 扫一遍字符串,若为0就一直竖着往下写0,碰到1就回头往上写,再碰到0 就回头往下写···…
Fox and Cross Time Limit: 1000MS   Memory Limit: 262144KB   64bit IO Format: %I64d & %I64u Submit Status Description Fox Ciel has a board with n rows and n columns. So, the board consists of n × n cells. Each cell contains either a symbol '.', or a s…
Rebranding Problem Description The name of one small but proud corporation consists of n lowercase English letters. The Corporation has decided to try rebranding - an active marketing strategy, that includes a set of measures to change either the bra…
B. Cards time limit per test:2 seconds memory limit per test:256 megabytes input:standard input output:standard output Catherine has a deck of n cards, each of which is either red, green, or blue. As long as there are at least two cards left, she can…
C. Report time limit per test:2 seconds memory limit per test:256 megabytes input:standard input output:standard output Each month Blake gets the report containing main economic indicators of the company "Blake Technologies". There are n commodi…