![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C++
文章平均质量分 51
一个只想躺平的咸鱼
这个作者很懒,什么都没留下…
展开
-
第三天 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 评论 -
2021 - 10 - 14多项式求值
#include<bits/stdc++.h>#define rep(i, a, b) for(int i = a; i <= b ; i ++ )#define per(i, a, b) for(int i = a; i >= b ; i -- )const int maxn = 1e4 + 10;typedef struct myStack{ int data[maxn]; int top;}mystack;typedef struct charStack原创 2021-10-14 16:08:31 · 51 阅读 · 0 评论