Codeforces Round #404 (Div. 2)】的更多相关文章

Codeforces Round #404 (Div. 2) 题意:对于 n and m (1 ≤ n, m ≤ 10^18)  找到 1) [n<= m] cout<<n; 2) [n>m]最小的 k => (k -m) * (k-m+1) >= (n-m)*2 成立 思路:二分搜索 #include <bits/stdc++.h> #include <map> using namespace std; #define LL long long…
昨晚玩游戏竟然不小心错过了CF..我是有多浪啊. 今天总算趁着下课时间补了,感觉最后两题还是挺有意思的,写个题解. D: 题目大意: 给出一个括号序列,问有多少个子序列 是k个'(' + k个')' 这样的形式.        n<=200000 解法: 对于每个'('的位置,计算以它为最右边的'('的合法子序列数. 假设它左边(包括它)有$l$个'(', 右边有 $r$个')' ,  如果子序列的长度2k, 那么 方案数有$\binom{l-1}{k-1} * \binom{r}{k}= \b…
D. Anton and School - 2 题目连接: http://codeforces.com/contest/785/problem/D Description As you probably know, Anton goes to school. One of the school subjects that Anton studies is Bracketology. On the Bracketology lessons students usually learn differ…
题目链接:http://codeforces.com/contest/785 A. Anton and Polyhedrons time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Anton's favourite geometric figures are regular polyhedrons. Note that there…
A. Anton and Polyhedrons time limit per test:2 seconds memory limit per test:256 megabytes input:standard input output:standard output Anton's favourite geometric figures are regular polyhedrons. Note that there are five kinds of regular polyhedrons:…
A. Anton and Polyhedrons 题目链接:http://codeforces.com/contest/785/problem/A 智障水题 实现代码: #include<bits/stdc++.h> using namespace std; int main(){ string s; ,t; cin>>t; while(t--){ cin>>s; if(s=="Tetrahedron") ans+=; else if(s==&quo…
C. Anton and Fairy Tale 题目连接: http://codeforces.com/contest/785/problem/C Description Anton likes to listen to fairy tales, especially when Danik, Anton's best friend, tells them. Right now Danik tells Anton a fairy tale: "Once upon a time, there liv…
B. Anton and Classes 题目连接: http://codeforces.com/contest/785/problem/B Description Anton likes to play chess. Also he likes to do programming. No wonder that he decided to attend chess classes and programming classes. Anton has n variants when he wil…
A - Anton and Polyhedrons 题目连接: http://codeforces.com/contest/785/problem/A Description Anton's favourite geometric figures are regular polyhedrons. Note that there are five kinds of regular polyhedrons: Tetrahedron. Tetrahedron has 4 triangular face…
http://codeforces.com/blog/entry/50996 官方题解讲得很明白,在这里我复述一下. 枚举每个左括号,考虑计算一定包含其的简单括号序列的个数,只考虑其及其左侧的左括号,以及其右侧的右括号.最后答案就是其之和. 可以将其提取出来这样((((((())),红色为当前左括号.设有x个左,y个右 要注意,这个答案为C(x+y-1,x),来证明. 我们只需证明,这个答案与长度为x+y-1的,包含x个1的零一序列的种类数相等即可. 随便写一个这样的零一序列,长度为x+y,但当…