CodeForces 747E Comments】的更多相关文章

栈,模拟. 手动写一个栈模拟一下过程即可. #include<cstdio> #include<cstring> #include<string> #include<cmath> #include<vector> #include<queue> #include<algorithm> #include<set> #include<stack> #include<iostream> usi…
[题目链接]:http://codeforces.com/problemset/problem/747/E [题意] 给你一个类似递归的结构; 让你把每一层的字符串按照层,一层层地输出出来; 并输出层数; [题解] 递归里面,写: 当前层开始的位置,这一层里面有多少个字符串,以及层的深度; 每次搞到下一层最右的下标就好; 然后每找到一个字符就加入到这一层里面; [Number Of WA] 0 [完整代码] #include <bits/stdc++.h> using namespace st…
这题本身是个水题,但是写了半天 题意就是给出一个树的生成方式,让你还原这棵树,然后按深度输出结点 这个还原过程还是比较有趣的(没有用递归) PS:getline的新姿势get #include <iostream> #include <vector> #include <queue> #include <cstdio> using namespace std; const int maxn = 1e6; int deep[maxn], c[maxn], f[…
Grigory loves strings. Recently he found a metal strip on a loft. The strip had length n and consisted of letters "V" and "K". Unfortunately, rust has eaten some of the letters so that it's now impossible to understand which letter was…
B. Radio Station time limit per test2 seconds memory limit per test256 megabytes Problem Dsecription As the guys fried the radio station facilities, the school principal gave them tasks as a punishment. Dustin's task was to add comments to nginx conf…
链接:https://codeforces.com/contest/1173/problem/A 题意: Nauuo is a girl who loves writing comments. One day, she posted a comment on Codeforces, wondering whether she would get upvotes or downvotes. It's known that there were xx persons who would upvote…
A. Eleven time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Eleven wants to choose a new name for herself. As a bunch of geeks, her friends suggested an algorithm to choose a name for her. El…
A. Nauuo and Votes 题目链接:http://codeforces.com/contest/1173/problem/A 题目 Nauuo is a girl who loves writing comments. One day, she posted a comment on Codeforces, wondering whether she would get upvotes or downvotes. It's known that there were xpersons…
http://codeforces.com/contest/599/problem/D 题意:给出总的方格数x,问有多少种不同尺寸的矩形满足题意,输出方案数和长宽(3,5和5,3算两种) 思路:比赛的时候gg了..其实稍微在纸上推一下.就会得到对于n,m的矩形,一共会有-n*n*n+3*n*n*m+n+3*n*m的方格.数量级是n3. 我们可以实际跑一遍.发现对于x1E18的数量级,n不会超过1442550,1E6,可以搞. 需要注意的是,一个是会爆int,所以记得用long long 另一个是…
坏味道--过多的注释(Comments) 特征 注释本身并不是坏事.但是常常有这样的情况:一段代码中出现长长的注释,而它之所以存在,是因为代码很糟糕. 问题原因 注释的作者意识到自己的代码不直观或不明显,所以想使用注释来说明自己的意图.这种情况下,注释就像是烂代码的除臭剂. 最好的注释是为函数或类起一个恰当的名字. 如果你觉得一个代码片段没有注释就无法理解,请先尝试重构,试着让所有注释都变得多余. 解决方法 如果一个注释是为了解释一个复杂的表达式,可以运用 提炼变量(Extract Variab…