随笔分类 - 题库—Codeforces比赛
摘要:This is an interactive problem.* There is a grid of 𝑛×𝑚n×m cells. Two treasure chests are buried in two different cells of the grid. Your task is to
阅读全文
摘要:#include <bits/stdc++.h> #define gcd(a, b) __gcd(a, b) #define INF 0x3f3f3f3f3f #define eps 1e-6 #define PI acos(-1.0) #define pb push_back #define fs
阅读全文
摘要:As you might remember from our previous rounds, Vova really likes computer games. Now he is playing a strategy game known as Rage of Empires. In the g
阅读全文
摘要:A. Equidistant Letters 直接对原字符串进行排序,这样能保证相同的字母相邻,间隔为0. #include <iostream> #include <vector> #include <algorithm> #define pii pair<int,int> #define fi
阅读全文
摘要:A. Div. 7 给一个数,问最少修改多少位可以让这个数被7整除。 注意到7小于10,因此每10个数必然有一个7,所以最多只需要修改一次个位即可。 #include <iostream> #include <cmath> #define ll long long using namespace s
阅读全文
摘要:A. ABC 签到,不解释 #include <iostream> #include <vector> using namespace std; int main() { int t; cin >> t; while(t--) { string s; int n; cin >> n; cin >>
阅读全文
摘要:Mihai has just learned about the MEX concept and since he liked it so much, he decided to use it right away. Given an array 𝑎a of 𝑛n non-negative in
阅读全文
摘要:You are given a rooted tree with root in vertex 1. Each vertex is coloured in some colour. Let's call colour c dominating in the subtree of vertex v i
阅读全文
摘要:The robot is located on a checkered rectangular board of size 𝑛×𝑚n×m (𝑛n rows, 𝑚m columns). The rows in the board are numbered from 11 to 𝑛n from
阅读全文
摘要:A. Era 维护一个新数组的末尾位置变量pos,遍历的时候不断更新即可。 #include <iostream> #include <vector> #include <algorithm> #include <cstring> #include <map> #include <set> #def
阅读全文
摘要:Codeforces Round #750 (Div. 2) A. Luntik and Concerts c要么为奇数要么为偶数,同时a和b都大于1,如果c为奇数的话拿出一个1一个2就可以把所有的3都平均分了,如果是偶数的话所有的3能直接平均分。同理再把b尽力平均分掉... #include <i
阅读全文
摘要:Your task is to calculate the number of arrays such that: each array contains 𝑛n elements; each element is an integer from 11 to 𝑚m; for each array,
阅读全文
摘要:链接:https://ac.nowcoder.com/acm/contest/21791/F 来源:牛客网 题目描述 给你两个数字 a a和 b b。一个数是由 a,b a,b两种数字构成,那么这个数是good;这个数的每一位加起来构成新的一个数,并且新数也是一个good数,那么称原数为excell
阅读全文
摘要:链接:https://ac.nowcoder.com/acm/contest/21791/E 来源:牛客网 题目描述 岛上有三种颜色的岛屿,分别是红色、蓝色和紫色。岛群分别由 a , b a,b和 c c个不同的岛组成。 在一些(可能全部或没有)岛屿之间建立了桥梁。一座桥双向连接两个不同的岛,长度为
阅读全文
摘要:The World is a Theatre time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output There are n boys
阅读全文
摘要:A tree is an undirected connected graph in which there are no cycles. This problem is about non-rooted trees. A leaf of a tree is a vertex that is con
阅读全文
摘要:Recently, Petya learned about a new game "Slay the Dragon". As the name suggests, the player will have to fight with dragons. To defeat a dragon, you
阅读全文
摘要:Ivan is playing yet another roguelike computer game. He controls a single hero in the game. The hero has 𝑛n equipment slots. There is a list of 𝑐𝑖c
阅读全文
摘要:Moamen was drawing a grid of 𝑛n rows and 109109 columns containing only digits 00 and 11. Ezzat noticed what Moamen was drawing and became interested
阅读全文
摘要:Moamen and Ezzat are playing a game. They create an array 𝑎a of 𝑛n non-negative integers where every element is less than 2𝑘2k. Moamen wins if 𝑎1&
阅读全文