随笔分类 - 算法-刷题题目 / cf好题
摘要:题目: 题目链接 You are given two integers nn and mm. Find the MEXMEX of the sequence n⊕0,n⊕1,…,n⊕mn⊕0,n⊕1,…,n⊕m. Here, ⊕ is the bitwise XOR operator. MEX of
阅读全文
摘要:This problem is an extension of the problem "Wonderful Coloring - 1". It has quite many differences, so you should read this statement completely. Rec
阅读全文
摘要:题目: 传送门: Consider a sequence of integers a1,a2,…,an In one move, you can select any element of the sequence and delete it. After an element is deleted
阅读全文
摘要:传送门 Polycarp has x of red and y of blue candies. Using them, he wants to make gift sets. Each gift set contains either a red candies and b blue candie
阅读全文
摘要:传送门 D. Another Problem About Dividing Numbers You are given two integers a and b. In one turn, you can do one of the following operations: Take an int
阅读全文
摘要:传送门 You are given an array aa of nn integers. Find the number of pairs (i,j)(i<j)where the sum of ai+ajai+aj is greater than or equal to l and less th
阅读全文
摘要:传送门 The weight of a sequence is defined as the number of unordered pairs of indexes (i,j)(here i<j) with same value (ai=aj). For example, the weight o
阅读全文
摘要:传送门 悬线法 题目大意: 对于一个长度为n的数列,找出一个子区间,使子区间内的最小值与子区间元素和的乘积最大,要求在满足舒适值最大的情况下最小化长度,最小化长度的情况下最小化左端点序号。 本题中我们可以考虑枚举最小值,将每个位置的数a[i]当作最小值,并考虑从i向左右扩展,找到满足 的尽可能向左右
阅读全文
摘要:传送门 给你一个正整数n。你真的很喜欢好的数字,所以你想找到最小的好数字大于或等于n。 如果正整数可以表示为3的不同幂的和(即不允许3的幂的重复),则称为好整数。Input对于给定的正整数n,找到最小的m(n≤m),m是一个好数。Output输入的第一行包含一个整数q(1≤q≤500)-查询数。接下
阅读全文
摘要:有 n 人, 每个人都正在读一本独一无二的小h书. 在每一天的结束的时候, 都会进行一次py交易,交易规则为:第 i 的人将给他的书给第 pi 的人 (如果i=pi,那么就是给他自己). 默认pi都是不同的数,是一个1到n的排列. 并且这个p是固定的,不随时间的改变而改变. 例如, 如果 n=6 并
阅读全文
摘要:传送门 推导数组元素,有n个大于0的数组元素,若将数组元素自小到大排序,相邻数组元素差值相等,再给出其中的两个元素x,y,要求推导出的数组元素的最大值,尽可能小。 输出可以是乱序的,并且数组中元素大于0,包括x和y Input 5 2 1 49 5 20 50 6 20 50 5 3 8 9 13
阅读全文