02 2023 档案
摘要:裁剪序列 给定一个长度为 的序列 ,要求把该序列分成若干段,在满足“每段中所有数的和”不超过 的前提下,让“每段中所有数的最大值”之和最小。 试计算这个最小值。 输入格式 第一行包含两个整数 和 。 第二行包含 个整数,表示完整的序列 。 输出格式
阅读全文
摘要:Devu和鲜花 Devu 有 个盒子,第 个盒子中有 枝花。 同一个盒子内的花颜色相同,不同盒子内的花颜色不同。 Devu 要从这些盒子中选出 枝花组成一束,求共有多少种方案。 若两束花每种颜色的花的数量都相同,则认为这两束花是相同的方案。 结果需对 $10^9+
阅读全文
摘要:构造新矩阵 给定一个 行 列的整数矩阵,行编号 ,列编号 。 其中,第 行第 列的元素为 。 你可以任意抽取其中不超过 行元素,这些元素之间保持同一行列关系不变,构成一个新矩阵。 构成新矩阵后,我们可
阅读全文
摘要:The Number of Good Subsets You are given an integer array nums . We call a subset of nums good if its product can be represented as a product of one o
阅读全文
摘要:Count the Number of Square-Free Subsets You are given a positive integer 0-indexed array nums . A subset of the array nums is square-free if the produ
阅读全文
摘要:Handling Sum Queries After Update You are given two 0-indexed arrays nums1 and nums2 and a 2D array queries of queries. There are three types of queri
阅读全文
摘要:D. Triangle Coloring You are given an undirected graph consisting of vertices and edges, where is divisible by . Each edge has a weight
阅读全文
摘要:约数之和 假设现在有两个自然数 和 , 是 的所有约数之和。 请你求出 的值是多少。 输入格式 在一行中输入用空格隔开的两个整数 和 。 输出格式 输出一个整数,代表 的值。 数据范围 $0 \
阅读全文
摘要:台阶-Nim游戏 现在,有一个 级台阶的楼梯,每级台阶上都有若干个石子,其中第 级台阶上有 个石子。 两位玩家轮流操作,每次操作可以从任意一级台阶上拿若干个石子放到下一级台阶中(不能不拿)。 已经拿到地面上的石子不能再拿,最后无法进行操作的人视为失
阅读全文
摘要:Nim游戏 给定 堆石子,两位玩家轮流操作,每次操作可以从任意一堆石子中拿走任意数量的石子(可以拿完,但不能不拿),最后无法进行操作的人视为失败。 问如果两人都采用最优策略,先手是否必胜。 输入格式 第一行包含整数 。 第二行包含 个数字,其中第 个数字表示第
阅读全文
摘要:D. Moscow Gorillas In winter, the inhabitants of the Moscow Zoo are very bored, in particular, it concerns gorillas. You decided to entertain them and
阅读全文
摘要:B. Fedya and Array For his birthday recently Fedya was given an array of integers arranged in a circle, For each pair of neighboring numbers (
阅读全文
摘要:Subsequence With the Minimum Score You are given two strings and . You are allowed to remove any number of characters from the string t. The s
阅读全文
摘要:Substring XOR Queries You are given a binary string s , and a 2D integer array queries where queries[i] = [firsti, secondi] . For the ith query, find
阅读全文
摘要:Count the Number of Fair Pairs Given a 0-indexed integer array nums of size n and two integers lower and upper , return the number of fair pairs. A pa
阅读全文
摘要:找数字 给定一个正整数 和一个非负整数 。 请你找到长度为 且各位数字之和为 的最小和最大非负整数。 要求所求非负整数不得包含前导零。 输入格式 共一行,两个整数 。 输出格式 在一行内输出满足条件的最小和最大非负整数。 如果无解,则输出 -1 -1。 数据范
阅读全文
摘要:B. Jumbo Extra Cheese 2 Pak Chanek has two-dimensional slices of cheese. The -th slice of cheese can be represented as a rectangle of dimension
阅读全文
摘要:D. Moving Dots We play a game with dots on a number line. The initial coordinate of the -th dot is . These coordinates are distinct. Every
阅读全文
摘要:B. Sum of Two Numbers The sum of digits of a non-negative integer is the result of summing up its digits together when written in the decimal syst
阅读全文
摘要:E. Sum Over Zero You are given an array of integers. Consider as a set of segments satisfying the following conditions
阅读全文
摘要:D. Lucky Permutation You are given a permutation of length . In one operation, you can choose two indices and swa
阅读全文
摘要:E. Monsters (hard version) This is the hard version of the problem. In this version, you need to find the answer for every prefix of the monster array
阅读全文
摘要:Disconnect Path in a Binary Matrix by at Most One Flip You are given a 0-indexed binary matrix grid . You can move from a cell (row, col)
阅读全文
摘要:Maximize Win From Two Segments There are some prizes on the X-axis. You are given an integer array prizePositions that is sorted in non-decreasing ord
阅读全文
摘要:G2. Teleporters (Hard Version) The only difference between the easy and hard versions are the locations you can teleport to. Consider the points $0,1,
阅读全文
摘要:E. Negatives and Positives Given an array consisting of elements, find the maximum possible sum the array can have after performing the follow
阅读全文
摘要:Minimum Cost to Make Array Equal You are given two 0-indexed arrays nums and cost consisting each of positive integers. You can do the following o
阅读全文
摘要:Count Increasing Quadruplets Given a 0-indexed integer array nums of size containing all numbers from to , return the number of increasing
阅读全文
摘要:Put Marbles in Bags You have k bags. You are given a 0-indexed integer array weights where weights[i] is the weight of the ith marble. You are also gi
阅读全文
摘要:牡牛和牝牛 约翰要带 只牛去参加集会里的展示活动,这些牛可以是牡牛,也可以是牝牛。 牛们要站成一排,但是牡牛是好斗的,为了避免牡牛闹出乱子,约翰决定任意两只牡牛之间至少要有 只牝牛。 请计算一共有多少种排队的方法,所有牡牛可以看成是相同的,所有牝牛也一样,答案对
阅读全文