[刷题]Codeforces 746G - New Roads】的更多相关文章

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…
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…
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…
题目链接: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 解决了内存问题,找有效徒弟复杂,找仇家简单,时间超了(最接近成功的一次…
题目链接:https://codeforces.com/contest/978/problem/D 题解: 题目的大意就是:这组序列能否组成等差数列?一旦构成等差数列,等差数列的公差必定确定,而且,对于给定的数列,公差的可能性是已知的. 我的解决思路是:对于给定的数列,最后一位数 - 第一位数 / (n -1) 必定是公差,而对于我们要判断的原数列,其最后一位 - 第一位数的值是可以-2,-1,0,+1,+2的,穷举可能性一切公差,找出变动最小的情况.代码如下(有点小复杂,没优化): #incl…
                                                                        G. New Roads                                                                    time limit per test: 2 seconds                                                             memory…
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…