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 different sequences that consist of round brackets (characters "(" and &quo…
http://codeforces.com/contest/794/problem/C Description Oleg the client and Igor the analyst are good friends. However, sometimes they argue over little things. Recently, they started a new company, but they are having trouble finding a name for the…
D. Anton and School - 2 time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output As you probably know, Anton goes to school. One of the school subjects that Anton studies is Bracketology. On the Br…
650A Watchmen 637A Voting for Photos 点击查看原题 650A又是一个排序去重的问题,一定要注意数据范围用long long ,而且在写计算组合函数的时候注意也要用long long 虽然10^9没有超过long的范围,但是在计算n*(n-1)/2的过程中超了,所以需要用long long ,否则会出错. #include<iostream> #include<cmath> #include<cstdlib> #include<c…
651B Beautiful Paintings 651A Joysticks 点击可查看原题 651B是一个排序题,只不过多了一步去重然后记录个数.每次筛一层,直到全为0.从这个题里学到一个正确姿势:给定一个排好序的的数组,怎么把它变成一个去重加权的新数组. 只需要一个while循环+一个指针. #define N 10 #include<iostream> using namespace std; int main() { ,,,,,,,,,}; int b[N]={}; int c[N]…
http://codeforces.com/problemset/problem/786/A Description Rick and Morty are playing their own version of Berzerk (which has nothing in common with the famous Berzerk game). This game needs a huge space, so they play it with a computer. In this game…
Description There are n cities in Berland, each of them has a unique id - an integer from 1 to n, the capital is the one with id 1. Now there is a serious problem in Berland with roads - there are no roads. That is why there was a decision to build n…
题目链接:https://codeforces.com/problemset/problem/785/D 题解: 首先很好想的,如果我们预处理出每个 "(" 的左边还有 $x$ 个 "(",以及右边有 $y$ 个 ")",那么就有式子如下: ① 若 $x+1 \le y$:$C_{x}^{0} C_{y}^{1} + C_{x}^{1} C_{y}^{2} + \cdots + C_{x}^{x} C_{y}^{x+1} = \sum_{i=0}…
题目链接:https://codeforces.com/contest/978/problem/G 题目大意:n天m门考试,每门考试给定三个条件,分别为:1.可以开始复习的日期.2.考试日期.3.必须要复习的时间.根据以上条件,给出每天的安排,每天可以做三件事:1.考试.2.复习.3.休息 题解:先假设每天都在休息,然后依次填东西,策略是最先考试的最先复习 AC代码: #include<cstdio> #include<cstring> #include<algorithm&…
题目链接:https://codeforces.com/contest/978/problem/F 题目大意: n个程序员,k对仇家,每个程序员有一个能力值,当甲程序员的能力值绝对大于乙程序员的能力值时,甲可以做乙的爸爸,对于每个程序员,它可以做多少人的爸爸?(仇家之间不能做父子) 题解: 第一次:WA 失误 第二次:TL 找有效徒弟和仇家时,太复杂 第三次:ML 找有效徒弟依然复杂,找仇家简单了,但是内存超了 第四次:TL 解决了内存问题,找有效徒弟复杂,找仇家简单,时间超了(最接近成功的一次…