CF729A Interview with Oleg 题解】的更多相关文章

Content 给出一个长度为 \(n\) 字符串 \(s\),请将开头为 \(\texttt{ogo}\),后面带若干个 \(\texttt{go}\) 的子串替换成 \(\texttt{***}\),然后输出. 数据范围:\(1\leqslant n\leqslant 100\). Solution 我们考虑遍历每个字符,如果这个字符是 \(\texttt{o}\),并且后面两个字符是 \(\texttt{go}\),那么直接替换成 \(\texttt{***}\),并且往后搜有没有 \(\…
Interview with Oleg time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Polycarp has interviewed Oleg and has written the interview down without punctuation marks and spaces to save time. Thus,…
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Polycarp has interviewed Oleg and has written the interview down without punctuation marks and spaces to save time. Thus, the interview is now a…
http://codeforces.com/contest/738/problem/A Polycarp has interviewed Oleg and has written the interview down without punctuation marks and spaces to save time. Thus, the interview is now a string s consisting of n lowercase English letters. There is…
题目链接:http://codeforces.com/contest/738/problem/A 题意:把ogo..ogo替换成***. 写的有点飘,还怕FST.不过还好 #include <bits/stdc++.h> using namespace std; ; int n, m; char s[maxn]; char t[maxn]; int main() { // freopen("in", "r", stdin); while(~scanf(&…
模拟. #pragma comment(linker, "/STACK:1024000000,1024000000") #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> #include<vector> #include<map> #include<set> #include<queue> #incl…
Content 有 \(n\) 支股票,第 \(i\) 支股票原价为 \(a_i\) 卢布.每秒钟可能会有任意一支股票的价格下降 \(k\) 卢布,以至于降到负数.求所有股票的价格均变得相同所要经过的最短时间,或者这不可能. 数据范围:\(1\leqslant n\leqslant 10^5,1\leqslant k,a_i\leqslant 10^9\). Solution 因为股票的价格只能够下降,因此肯定是要求最后都要降到 \(n\) 支股票的价格的最小值 \(x\).然后,因为每秒下降…
A. Interview time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Blake is a CEO of a large company called "Blake Technologies". He loves his company very much and he thinks that his compan…
刷题备忘录,for bug-free 招行面试题--求无序数组最长连续序列的长度,这里连续指的是值连续--间隔为1,并不是数值的位置连续 问题: 给出一个未排序的整数数组,找出最长的连续元素序列的长度. 如: 给出[100, 4, 200, 1, 3, 2], 最长的连续元素序列是[1, 2, 3, 4].返回它的长度:4. 你的算法必须有O(n)的时间复杂度 . 解法: 初始思路 要找连续的元素,第一反应一般是先把数组排序.但悲剧的是题目中明确要求了O(n)的时间复杂度,要做一次排序,是不能达…
A. Interview 题目连接: http://www.codeforces.com/contest/631/problem/A Description Blake is a CEO of a large company called "Blake Technologies". He loves his company very much and he thinks that his company should be the best. That is why every can…