![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
思维
文章平均质量分 62
一个只想躺平的咸鱼
这个作者很懒,什么都没留下…
展开
-
第三天 C. Mind Control
You and your n−1 friends have found an array of integers a1,a2,…,an. You have decided to share it in the following way: All nof you stand in a line in a particular order. Each minute, the person at the front of the line chooses either the first or the las原创 2022-01-16 03:11:02 · 83 阅读 · 0 评论 -
第三天 B. Rubik‘s Cube Coloring (easy version)
It is the easy version of the problem. The difference is that in this version, there are no nodes with already chosen colors.Theofanis is starving, and he wants to eat his favorite food, sheftalia. However, he should first finish his homework. Can you hel原创 2022-01-16 03:07:58 · 120 阅读 · 0 评论 -
第三天 A. Social Network (easy version)
The only difference between easy and hard versions are constraints on nand k.You are messaging in one of the popular social networks via your smartphone. Your smartphone can show at most kmost recent conversations with your friends. Initially, the scre原创 2022-01-16 03:04:30 · 108 阅读 · 0 评论 -
第二天 、D. Minimize The Integer
传送门思路如下:奇偶性不同的两个数可以交换位置,求使得这个数最小的情况。由于只能交换相邻奇偶的数,所以奇偶数字的相对位置一定不变,把他们分别存在两个数组里,按大小输出即可代码如下:int T = 1; cin >> T; while(T --){ string s; cin >> s; int c1 = 0, c2 = 0; a[1] = 10, b[1] = 10; rep(i, 0, s.size()原创 2022-01-13 16:47:03 · 171 阅读 · 0 评论 -
第二天 C. Phoenix and Distribution
传送门思路如下:把一个字符串分成k 份,使最大的字典序最小。先把字符串sort,然后分类讨论1.如果前k - 1个一样1.1 如果第k 个和最后一个一样,均分剩余字符串,输出最长的1.2 如果不一样,把后面所有的接到第一个后面输出2.如果前k - 1个不一样,直接输出第k - 1 个代码如下: int T = 1; cin >> T; while(T --){ int n, k, cat; cin >> n >>原创 2022-01-13 16:44:03 · 76 阅读 · 0 评论 -
第二天 B. Everyone is a Winner
传送门思路如下:寻找一个数n可以被哪些数整除,其实只需要从1寻找到根号n,然后用set去重,别忘记补0。代码如下: int T = 1; cin >> T; while(T --){ int n; cin >> n; set<int> s; rep(i, 1, sqrt(n)){ s.insert(i); s.insert(n/i); }原创 2022-01-13 16:37:38 · 50 阅读 · 0 评论 -
第二天 A. Make it Divisible by 25
传送门思路如下:寻找一个数字使他可以被25整除,需要删掉多少位。一个数字可以被25整除,只需要判断最后两位:00,50,25,75代码如下: int T = 1; cin >> T; while(T --){ string s; cin >> s; int cnt = 0; bool f1 = false, f2 = false; per(i, s.size() - 1, 0){原创 2022-01-13 16:15:11 · 159 阅读 · 0 评论 -
第一天 D. Building a Fence
You want to build a fence that will consist of n equal sections. All sections have a width equal to 1 and height equal to k. You will place all sections in one line side by side.Unfortunately, the ground beneath the fence is not flat. For simplicity, you原创 2022-01-12 00:49:44 · 154 阅读 · 0 评论 -
第一天 C. Chocolate Bunny
This is an interactive problem.We hid from you a permutation pof length n, consisting of the elements from 1 to n. You want to guess it. To do that, you can give us 2 different indices i and j, and we will reply with pimodpj (remainder of division pi by原创 2022-01-11 23:33:08 · 436 阅读 · 0 评论 -
第一天 B. Diverse Matrix
Let a be a matrix of size r×c containing positive integers, not necessarily distinct. Rows of the matrix are numbered from 1 to r, columns are numbered from 1 to c. We can construct an array b consisting of r+c integers as follows: for each i∈[1,r], let bi原创 2022-01-11 20:26:04 · 52 阅读 · 0 评论 -
第一天 A. Good ol‘ Numbers Coloring
Consider the set of all nonnegative integers: 0,1,2,…. Given two integers a and b (1≤a,b≤104). We paint all the numbers in increasing number first we paint 0, then we paint 1, then 2and so on.Each number is painted white or black. We paint a number iacc原创 2022-01-11 19:57:54 · 296 阅读 · 0 评论 -
2021-09-03 D. Zero Quantity Maximization
You are given two arrays a and b, each contains n integers.You want to create a new array c as follows: choose some real (i.e. not necessarily integer) number d, and then for every i∈[1,n] let ci:=d⋅ai+bi.Your goal is to maximize the number of zeroes in原创 2021-09-04 10:32:31 · 80 阅读 · 0 评论 -
2021 - 09 - 02 Anu Has a Function
A. Anu Has a Functiontime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAnu has created her own function f: f(x,y)=(x|y)−y where | denotes the bitwise OR operation. For example, f(11,6)=(11|6)−6=15−6=9原创 2021-09-02 22:28:30 · 65 阅读 · 0 评论 -
2021 - 8 - 12 Codeforces C. Binary String Reconstruction
Consider the following process. You have a binary string (a string where each character is either 0 or 1) w of length n and an integer x. You build a new binary string s consisting of n characters. The i-th character of s is chosen as follows:if the chara原创 2021-08-12 20:57:13 · 72 阅读 · 0 评论 -
2021-08-12
Codeforce C. Mere Arraytime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given an array a1,a2,…,an where all ai are integers and greater than 0.In one operation, you can choose two different原创 2021-08-12 11:32:22 · 96 阅读 · 0 评论