Codeforces 894.A QAQ】的更多相关文章

A. QAQ time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output "QAQ" is a word to denote an expression of crying. Imagine "Q" as eyes with tears and "A" as a mouth. Now Dia…
题目链接:http://codeforces.com/problemset/problem/894/E 题目大意: $n$个点$m$条边的有向图,每条边有一个权值,可以重复走. 第$i$次走过某条边权为$w$的边后这条边的边权变成$w-i$,但不能小于等于$0$. 给定起点,询问任意走最多能获得多少的边权 题解: 显然一个强联通分量的边可以全部走到$0$为止. 考虑强连通分量中一条边权为w的边对答案的贡献,$s=w+w-1+w-1-2+w-1-2-3\ldots$ 设这个式子有$t+1$项,显然…
A.QAQ 题目大意:从给定的字符串中找出QAQ的个数,三个字母的位置可以不连续 思路:暴力求解,先找到A的位置,往前扫,往后扫寻找Q的个数q1,q2,然 后相乘得到q1*q2,这就是这个A能够找到的QAQ个数,依次累加即可 #include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); string s; cin>>s;…
E. Ralph and Mushrooms time limit per test 2.5 seconds memory limit per test 512 megabytes input standard input output standard output Ralph is going to collect mushrooms in the Mushroom Forest. There are m directed paths connecting n trees in the Mu…
C. Marco and GCD Sequence time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output In a dream Marco met an elderly man with a pair of black glasses. The man told him the key to immortality and then…
D. Ralph And His Tour in Binary Country time limit per test 2.5 seconds memory limit per test 512 megabytes input standard input output standard output Ralph is in the Binary Country. The Binary Country consists of n cities and (n - 1) bidirectional…
B. Ralph And His Magic Field time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Ralph has a magic field which is divided into n × m blocks. That is to say, there are n rows and m columns on th…
A. QAQ time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output "QAQ" is a word to denote an expression of crying. Imagine "Q" as eyes with tears and "A" as a mouth. Now Dia…
B. Nikita and string One day Nikita found the string containing letters "a" and "b" only. Nikita thinks that string is beautiful if it can be cut into 3 strings (possibly empty) without changing the order of the letters, where the 1-st…
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] C语言程序练习题 [代码] #include <bits/stdc++.h> using namespace std; string s; int main(){ #ifdef LOCAL_DEFINE freopen("F:\\c++source\\rush_in.txt", "r", stdin); #endif ios::sync_with_stdio(0),cin.tie(0);…