Codeforces 938.A Word Correction】的更多相关文章

A. Word Correction time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Victor tries to write his own text editor, with word correction included. However, the rules of word correction are really…
题目链接:Buy a Ticket 题意: 给出n个点m条边,每个点每条边都有各自的权值,对于每个点i,求一个任意j,使得2×d[i][j] + a[j]最小. 题解: 这题其实就是要我们求任意两点的最短路,但是从点的个数上就知道这题不可以用floyd算法,其实多元最短路可以用dijkstra算.@.@!把所有的点的权值和点放到结构体里面,放入优先队列,其实这样就能保证每次拓展到的点就是这个点的最短路(因为是优先队列,保证拓展到的点这时候的值是最小的),其实就是这个点想通就很简单. #inclu…
D. Buy a Ticket time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Musicians of a popular band "Flayer" have announced that they are going to "make their exit" with a world tou…
C. Constructing Tests time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Let's denote a m-free matrix as a binary (that is, consisting of only 1's and 0's) matrix such that every square submat…
B. Run For Your Prize time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You and your friend are participating in a TV show "Run For Your Prize". At the start of the show n prizes are loc…
A #include <bits/stdc++.h> #define PI acos(-1.0) #define mem(a,b) memset((a),b,sizeof(a)) #define TS printf("!!!\n") #define pb push_back #define inf 1e9 //std::ios::sync_with_stdio(false); using namespace std; //priority_queue<int,vect…
Content 有一个长度为 \(n\) 的,只包含小写字母的字符串,只要有两个元音字母相邻,就得删除后一个元音字母(\(\texttt{a,e,i,o,u,y}\) 中的一个),请求出最后得到的字符串. 数据范围:\(1\leqslant n\leqslant 100\). Solution 我们遍历字符串,判断当前扫到的字符是否是元音字母,这样好在遍历到下一个字母时判断是否需要删除,不需要的话直接输出当前字符就好. Code string s; int vowel = 0, n; int m…
这场打了小号 A. Word Correction time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Victor tries to write his own text editor, with word correction included. However, the rules of word correction are…
[比赛链接] 点击打开链接 [题解] Problem A Word Correction[字符串] 不用多说了吧,字符串的基本操作 Problem B  Run for your prize[贪心] 我们可以将这个数轴一分为二,小于等于500000的由第一个人领,否则由第二个人领 Problem C Constructing tests[贪心][数学] 首先我们发现 : N^2 - (N / M)^2 = x (N/M向下取整) 然后我们算出N的上下界,发现: sqrt(x+1)<=N<=sq…
Word Cut 题目连接: http://codeforces.com/problemset/problem/176/C Description Let's consider one interesting word game. In this game you should transform one word into another through special operations. Let's say we have word w, let's split this word in…
Word Cut Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Practice CodeForces 176B Description Let's consider one interesting word game. In this game you should transform one word into another through specia…
B. Complete the Word time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output ZS the Coder loves to read the dictionary. He thinks that a word is nice if there exists a substring (contiguous segmen…
Codeforces Round #372 (Div. 2) 不知不觉自己怎么变的这么水了,几百年前做A.B的水平,现在依旧停留在A.B水平.甚至B题还不会做.难道是带着一种功利性的态度患得患失?总共才打的几场 CF 节节掉分.学了快一年了成了个水货. 废话就不多说了,来看这次的这两题吧.很多CF的题是不想写博客的,如果题目质量很好的话我倒是愿意留在我的博客里: A. Crazy Computer time limit per test 2 seconds memory limit per te…
codeforces 372 Complete the Word(双指针) 题链 题意:给出一个字符串,其中'?'代表这个字符是可变的,要求一个连续的26位长的串,其中每个字母都只出现一次 #include<queue> #include<cmath> #include<cstdio> #include<cstring> #include<cstdlib> #include<iostream> #include<algorith…
题目链接:http://codeforces.com/problemset/problem/716/B 题目大意: 给出一个字符串,判断其是否存在一个子串(满足:包含26个英文字母且不重复,字串中有‘?’表示占位符可表示字母),如果存在则输出该字串‘?’位置用替换后的字母代替,其他不在子串中的‘?’用字母代替即可.如果该字串不存在满足条件的子串,则输出-1. 举例: ---------------------------------- input ABC??FGHIJK???OPQR?TUVWX…
ZS the Coder loves to read the dictionary. He thinks that a word is nice if there exists asubstring (contiguous segment of letters) of it of length 26 where each letter of English alphabet appears exactly once. In particular, if the string has length…
题目链接:http://www.codeforces.com/problemset/problem/281/A题意:将一个英文字母的首字母变成大写,然后输出.C++代码: #include <cstdio> #include <cstring> ]; void solve(char *s) { if (*s >= 'a' && *s <= 'z') *s -= ; while (*s) { putchar(*s); s ++; } } int main(…
B. Complete the Word time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output ZS the Coder loves to read the dictionary. He thinks that a word is nice if there exists a substring (contiguous segmen…
Description Let's consider one interesting word game. In this game you should transform one word into another through special operations. Let's say we have word w, let's split this word into two non-empty parts x and y so, that w = xy. A split operat…
B. Word Cut   Let's consider one interesting word game. In this game you should transform one word into another through special operations. Let's say we have word w, let's split this word into two non-empty parts x and y so, that w = xy. A split oper…
[题目] C. Smallest Word [描述] IA有一个由若干个'a'和'b'组成的字符串,IA可以翻转该字符串的任意长的前缀,IA想通过这样的操作得到一个字典序最小的字符串,求一种可能的翻转方案.输出是否翻转长度为k的前缀,k=1,2,...,n,n为该字符串长度. 数据范围:1<=字符串长度<=1000 [思路] 为了把第m+1个字符挪到第1个位置并保持其他字符不动,可以翻转m长的和m+1长的前缀(先后顺序不影响结果).于是,我们可以通过这样的操作把每一个'a'挪到最前面,最后就得…
Description 题库链接 给你两个字符串 \(S\) 和 \(T\) ,准许你 \(k\) 次操作,每次将字符串左右分成两个非空的部分,再交换位置,问你有多少种不同的操作方法将 \(S\) 串变为 \(T\) 串. \(1\leq k\leq 100000, 1\leq |S|=|T|\leq 1000\) Solution 容易发现不论经过多少次操作,其操作后的字符串一定是在原字符串上截开两段再拼接而成. 所以不妨记 \(f_{i,j}\) 为操作 \(i\) 次后在 \(j\) 处截…
首先会想到|x|是不递减的. 于是可以枚举长度L. 再每个L设一个断点,xx必定经过两个断点. 两两断点间求最长公共前后缀,这里用hash+二分会快. 然后一波扫过去就好了. 如果找到了,hash就要重构. 来计算一下复杂度. 一共有O(n log n)个断点,每个求最长公共前后缀复杂度log,这一部分是O(n log^2 n ) 长度小于 \(L \leq n\)的最多 \(n\sqrt n\)次,\(L\geq n\)最多 \(n\sqrt n\)中,所以重构复杂度: \(O(n \sqrt…
[链接] 我是链接,点我呀:) [题意] [题解] 模拟了一两下.. 然后发现. 对于每一个前缀. 组成的新的最小字典序的字符串 要么是s[i]+reverse(前i-1个字符经过操作形成的最大字典序的字符串);或者是 (前i-1个字符经过操作形成的最小字典序的字符串)+s[i] 因为最大字典序,翻转一下,然后把s[i]放前面..显然更可能得到较小字典序的字符串. 这个最大字典序的字符串类似处理一下就Ok. [代码] #include <bits/stdc++.h> #define rep1(…
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Let's define a grid to be a set of tiles with 2 rows and 13 columns. Each tile has an English letter written in it. The letters don't have to be…
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/problemset/problem/662/A 题目大意: 给定n(n <= 500000)张卡片,每张卡片的两个面都写有数字,每个面都有0.5的概率是在正面,各个卡牌独立.求把所有卡牌来玩Nim游戏,先手必胜的概率. (⊙o⊙)-由于本人只会在word文档里写公式,所以本博客是图片格式的. Code #include <cstdio> #include <cstring> #include <algorithm> u…
题意: 思路: Codeforces Round #370(Solved: 4 out of 5) A - Memory and Crow 题意:有一个序列,然后对每一个进行ai = bi - bi + 1 + bi + 2 - bi + 3.... 的操作,最后得到了a 序列,给定 a 序列,求原序列. 思路:水. #include <set> #include <map> #include <stack> #include <queue> #includ…
题目 Source http://codeforces.com/problemset/problem/717/G Description You have recently fallen through a hole and, after several hours of unconsciousness, have realized you are in an underground city. On one of your regular, daily walks through the un…
A. Watching a movie time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You have decided to watch the best moments of some movie. There are two buttons on your player: Watch the current minute…