
codeforces
文章平均质量分 81
王马软
因为原地不动,便永远地下沉
展开
-
codeforces A. MEX maximizing
codeforces A. MEX maximizing题干Recall that MEX of an array is a minimum non-negative integer that does not belong to the array. Examples:for the array [0,0,1,0,2] MEX equals to 3 because numbers 0,1 and 2 are presented in the array and 3 is the minimum n原创 2021-05-25 21:12:10 · 219 阅读 · 0 评论 -
codeforces C. Trouble Sort - 摸鱼
codeforces C. Trouble Sort - 摸鱼题干Ashish has n elements arranged in a line.These elements are represented by two integers ai — the value of the element and bi — the type of the element (there are only two possible types: 0 and 1).He wants to sort the el原创 2021-05-14 22:58:50 · 123 阅读 · 0 评论 -
leetcode 872.叶子相似的树
leetcode 872.叶子相似的树题干请考虑一棵二叉树上所有的叶子,这些叶子的值按从左到右的顺序排列形成一个 叶值序列 。举个例子,如上图所示,给定一棵叶值序列为 (6, 7, 4, 9, 8) 的树。如果有两棵二叉树的叶值序列是相同,那么我们就认为它们是 叶相似 的。如果给定的两个根结点分别为 root1 和 root2 的树是叶相似的,则返回 true;否则返回 false 。示例 1:输入:ro原创 2021-05-10 16:46:18 · 239 阅读 · 0 评论 -
codeforces I. Make It Good - 规律
codeforces I. Make It Good - 规律题干You are given an array a consisting of n integers. You have to find the length of the smallest (shortest) prefix of elements you need to erase from a to make it a good array. Recall that the prefix of the array a=[a1,a2,…原创 2021-05-07 23:03:25 · 278 阅读 · 0 评论 -
codeforces D. Subsequence Hate - 前缀和枚举
codeforces D. Subsequence Hate - 前缀和枚举题干Shubham has a binary string s. A binary string is a string containing only characters “0” and “1”.He can perform the following operation on the string any amount of times:Select an index of the string, and flip t原创 2021-05-07 22:58:39 · 188 阅读 · 0 评论 -
codeforces A. Game On Leaves
codeforces A. Game On Leaves题干Ayush and Ashish play a game on an unrooted tree consisting of n nodes numbered 1 to n. Players make the following move in turns:Select any leaf node in the tree and remove it together with any edge which has this node as o原创 2021-05-07 21:01:51 · 177 阅读 · 0 评论 -
codeforces B. Decrease the Sum of Digits - 模拟+优化
codeforces B. Decrease the Sum of Digits题干You are given a positive integer n. In one move, you can increase n by one (i.e. make n:=n+1).Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of n be less原创 2021-05-05 21:59:50 · 111 阅读 · 0 评论 -
codeforces Pictures with Kittens(easy & hard version) - 动态规划
codeforces Pictures with Kittens(easy & hard version) - 动态规划题干The only difference between easy and hard versions is the constraints.Vova likes pictures with kittens. The news feed in the social network he uses can be represented as an array of n con原创 2021-05-01 23:40:12 · 242 阅读 · 0 评论 -
codeforces日常训练 C. Cutting Out - 二分搜索答案
codeforces日常训练 C. Cutting Out - 二分搜索答案题干You are given an array s consisting of n integers.You have to find any array t of length k such that you can cut out maximum number of copies of array t from array s.Cutting out the copy of t means that for each原创 2021-04-30 23:04:56 · 361 阅读 · 1 评论