- 博客(7)
- 收藏
- 关注
原创 Sequence with Digits CodeForces - 1355A(暴力+数学)
题意: 定义: an+1=an+minDigit(an)×maxDigit(an)。 给定 a1 和 k,求 ak ? 题目: Let’s define the following recurrence: an+1=an+minDigit(an)⋅maxDigit(an). Here minDigit(x) and maxDigit(x) are the minimal and maximal digits in the decimal representation of x without leading
2020-05-23 22:00:42 283
原创 K-periodic Garland CodeForces - 1353E(暴力+贪心+dp)
题意: 给定长为 n 的 0, 1 字符串,你可以通过一次操作改变一个字符(0 变 1 or 1 变 0),问最少几次操作可以使任意相邻两个 1 之间的距离为 k ? 题目: You are given a garland consisting of n lamps. States of the lamps are represented by the string s of length n. The i-th character of the string si equals ‘0’ if the i-
2020-05-22 21:59:51 589
原创 Constructing the Array CodeForces - 1353D(数据结构+分类+建设性算法)
题意: 有长度为 n 的数组 a ,全为 0,接下来循环 n 次,每次选出一段最长的连续区间 [l, r](全为 0 ,如果一样长,就选最左边的)。 如果 r−l+1 是奇数,那么 a[l+r2]=ia[\frac{l+r}{2}]=ia[2l+r]=i; 否则,a[l+r−12]=ia[\frac{l+r-1}{2}]=ia[2l+r−1]=i;(i 是第几轮循环)。 输出最终的数组 a。 题目: You are given an array a of length n consisting of z
2020-05-22 21:35:33 386
原创 Board Moves CodeForces - 1353C(数学)
题意: 有一个 n×n 的矩阵(n 为奇数),每个矩阵单元有一个物品,每次操作你可将一个单元里的一个物品移动到该单元周围的八个单元里,问最后只有一个单元有物品的情况下,最少要多少次操作? 题目: You are given a board of size n×n, where n is odd (not divisible by 2). Initially, each cell of the board contains one figure. In one move, you can select exa
2020-05-21 21:58:51 174
原创 Two Arrays And Swaps CodeForces - 1353B(贪心+分类)
题意: 给定两个数组,你可以交换 k 次 两个数组的元素,问最后 a 数组的和最大可以是多少? 题目: You are given two arrays a and b both consisting of n positive (greater than zero) integers. You are also given an integer k. In one move, you can choose two indices i and j (1≤i,j≤n) and swap ai and bj (
2020-05-21 21:50:59 367
原创 Most Unstable Array CodeForces - 1353A(数学+贪心+建设性算法)
题意: 给定 n, m,构造出一个长度为 n 的数组 a,使得数组的和为 m,在此条件下∑i=1n−1∣ai−ai−1∣\sum_{i=1}^{n-1}|a_{i}−a_{i-1}|i=1∑n−1∣ai−ai−1∣ 最大是多少? 题目: You are given two integers n and m. You have to construct the array a of length n consisting of non-negative integers (i.e. integers g
2020-05-21 21:44:48 386
原创 Enlarge GCD CodeForces - 1034A(欧拉筛+最大公约数)
题意: 给出n个数,删去其中一些使得总的gcd(最大公约数)最大 题目: Mr. F has n positive integers, a1,a2,…,an. He thinks the greatest common divisor of these integers is too small. So he wants to enlarge it by removing some of the integers. But this problem is too simple for him, so he
2020-05-14 22:06:01 245
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人