
训练赛病历
_Daredevil_
纸上得来终觉浅,
绝知此事要躬行。
展开
-
2020 牛客多校 第六场 E-Easy Construction(思维)
题目链接: E-Easy ConstructionDescription题意:给出n, k, 求是否存在连续任意个数的和模n为k,并输出序列InputThe first line contains two integers n, k(1 <= n <= 5000, 0 <= k < n).OutputPrint n integers, the answer permutation in one line if such permutation exists, or原创 2020-09-12 12:55:53 · 335 阅读 · 0 评论 -
2020 牛客多校 第六场 C-Combination of Physics and Maths(思维)
题目链接: C-Combination of Physics and MathsDescription题意:给出一个二维矩阵,求最大压力,压力为子矩阵之和除子矩阵底层元素之和InputThere are multiple test cases. The first line of input contains an integer T(T <= 100).indicating the number of test cases. For each test case:The first原创 2020-09-12 12:54:28 · 329 阅读 · 0 评论 -
2020 牛客多校 第五场 F-DPS(签到)
题目链接: F-DPSDescription题意:给出一组序列,输出伤害面板图表When you are playing multiplayer games, you may want to show that you are the MVP of your team – or blame the one always wandering and watching away from the storm center. Well, there’re statistics that show you p原创 2020-09-04 10:45:18 · 193 阅读 · 0 评论 -
2020 牛客多校 第五场 D-Drop Voicing(贪心 + LIS)
题目链接: D-Drop VoicingDescription题意:给出一个序列,求通过两种操作用最少的操作次数可以把序列有序Inaka composes music. Today’s arrangement includes a chord of n notes that are pairwise distinct, represented by a permutation p1…pn of integers from 1 to n (inclusive) denoting the notes fr原创 2020-09-04 10:44:33 · 264 阅读 · 0 评论 -
2020 牛客多校 第四场 H-Harder Gcd Problem(贪心 + 思维)
题目链接: H-Harder Gcd ProblemDescription题意:给出1~n的序列,求gcd>1的最大组数并输出任意一种方案After solving the Basic Gcd Problem, ZYB gives you a more difficult one:Given an integer n, find two subset A and B of {1,2,…,n} such that:∣A∣=∣B∣=m and A∩B=∅ Let A={a1,a2,…,am} a原创 2020-09-04 10:43:41 · 228 阅读 · 0 评论 -
NowCoder 练习 —— 牛妹爱数列(DP)
题目链接: 牛妹爱数列一、题目描述他手里有一个长度为n的序列a,保证它是一个01序列,并执行以下两种操作:单点修改:将位置x上的数翻转(0变1,1变0);前缀修改:将位置1~x上的数翻转(每个数都0变1,1变0)。他现在想要最小化翻转次数,使得数列上的所有数都变为0。二、输入描述:第一行,输入一个数n第二行,输入n个数,第i个数表示ai数据保证1≤n≤105, 0≤ai≤1三、输出描述:输出最小翻转次数示例1:输入101 0 1 1 0 0 0 1 0 0输出3原创 2020-08-24 09:56:29 · 386 阅读 · 1 评论 -
NowCoder 练习 —— 3的倍数(DFS + 回溯)
题目链接: 3的倍数一、题目描述给你 nn 个字符串,每个字符串最多包含 A - ZA−Z 这26个字母,KevenKeven 现在取了一些字符串,发现每个字母出现的次数都是 33 的倍数,KevenKeven 现在想要知道在满足每个字母出现的次数都是 33 的倍数的前提下,最多能取多少个字符串。二、输入描述:第一行一个数字 n,表示字符串的个数(1<=n<=15)接下来 n 行,每行一个字符串 s(1<=strlen(s)<=10000)三、输出描述:在一行中输出原创 2020-08-24 09:55:54 · 706 阅读 · 0 评论 -
NowCoder 练习 —— 数数(数学)
题目链接: 数数一、题目描述二、输入描述:多组数据。第一行一个数 T,表示测试数据组数。(1 <= T <= 5)接下来 T 行,每行一个数 n。(1 <= n <= 107)三、输出描述:对于每一组测试数据,输出一行两个数,即这组测试数据的答案。示例1:输入11输出1 1四、思路很显然的数学结论题。对于第一个式子 求和为 S[x] = (n*(n+1)/2)2对于第二个式子 求和为 S[x] = (x!)2*n六、Code#inc原创 2020-08-24 09:54:45 · 196 阅读 · 0 评论 -
NowCoder 练习 —— 矩阵消除游戏(思维+枚举)
题目链接: 矩阵消除游戏一、题目描述牛妹在玩一个名为矩阵消除的游戏,矩阵的大小是n行m列,第i行第j列的单元格的权值为a[i][j],牛妹可以进行k个回合的游戏,在每个回合,牛妹可以选择一行或者选择一列,然后将这一行或者这一列的所有单元格中的权值变为0,同时牛妹的分数会加上这一行或者这一列中的所有单元格的权值的和。牛妹想最大化她的得分,球球你帮帮她吧二、输入描述:第一行三个整数n,m,k接下来n行每行m个整数表示矩阵中各个单元格的权值。1≤n,m≤151≤a[i][j]≤1e61≤k≤n原创 2020-08-24 09:52:36 · 340 阅读 · 0 评论 -
NowCoder 练习 —— 救救企鹅 (KMP)
题目链接: 购物一、题目描述另一天,一只可爱的围着围巾的肥企鹅在路上摇摇晃晃地走着,遇上了迎面走来的打着饱嗝的PM6。小企鹅预感不妙,这不就是最近有名的恶人PM6么!吓得立刻扭头就想跑。PM6:“小火汁,站住!我不吃你(谁叫你是保护动物)。我这有一道简单题,如果你答对了,我就给你吃鱼肉,如果你答错了,就免费帮我充游戏币!”企鹅:“(:3J∠)(默默摘掉围巾)”PM6:“我给你一个文本串 S ,再给你两个串A、B,你要将文本串中的 A 都转换成 B ,转换后的字符不再参与转换,输出最终的文本串。”原创 2020-08-24 09:51:04 · 324 阅读 · 0 评论 -
NowCoder 练习 —— 购物 (DP)
题目链接: 购物一、题目描述在遥远的东方,有一家糖果专卖店。这家糖果店将会在每天出售一些糖果,它每天都会生产出m个糖果,第i天的第j个糖果价格为C[i][j]元。现在的你想要在接下来的n天去糖果店进行选购,你每天可以买多个糖果,也可以选择不买糖果,但是最多买m个。(因为最多只生产m个)买来糖果以后,你可以选择吃掉糖果或者留着之后再吃。糖果不会过期,你需要保证这n天中每天你都能吃到至少一个糖果。这家店的老板看你经常去光顾这家店,感到非常生气。(因为他不能好好睡觉了)于是他会额外的要求你支付点钱。具体原创 2020-08-24 09:47:10 · 319 阅读 · 0 评论 -
2020 HDU多校 第四场 05-Equal Sentences(思维 + Hash)
题目链接: 05-Blow up the EnemyDescription题意:给定n个字符串,求可变换字符串使得与原串相比,字符串位置绝对值只差不超过1的个数Sometimes, changing the order of the words in a sentence doesn’t influence understanding. For example, if we change “what time is it”, into “what time it is”; or change “orz原创 2020-08-24 09:46:20 · 232 阅读 · 0 评论 -
2020 HDU多校 第四场 02-Blow up the Enemy(贪心 + Map)
题目链接: 02-Blow up the EnemyDescription题意:给出n把武器的伤害值和使用间隔,求选中互相攻击必胜的概率Zhang3 is playing a shooting game with Father. In the game there are two players trying to kill each other to win the game.The game provides n weapons, each has two properties: Damage原创 2020-08-24 09:45:03 · 229 阅读 · 0 评论 -
2020 HDU多校 第三场 04-Tokitsukaze and Multiple(贪心 + 前缀和)
题目链接: 04-Tokitsukaze and MultipleDescription题意:给出n个数和p,求最多可以有多少个不相交的连续子序列和可以整除pTokitsukaze has a sequence of length n, denoted by a.Tokitsukaze can merge two consecutive elements of a as many times as she wants. After each operation, a new element that原创 2020-08-04 11:25:32 · 500 阅读 · 0 评论 -
2020 HDU多校 第二场 12-String Distance(DP + 序列自动机)
题目链接: 12-String DistanceDescription题意:给出串a, b, 求给定询问长度的a串与b串的距离For two strings S and T, you can do the following operation for arbitrary number of times: Select a string S or T, insert or delete a character at any position. The distance between two stri原创 2020-08-03 17:24:07 · 286 阅读 · 0 评论 -
2020 HDU多校 第二场 06-The Oculus(斐波那契 + 哈希)
题目链接: 06-The OculusDescription题意:给出a, b, c的斐波那契01序列,求 c 序列中哪一位错误使得a*b != cLet’s define the Fibonacci sequence F1,F2,… as F1=1,F2=2,Fi=Fi−1+Fi−2 (i≥3).It’s well known that every positive integer x has its unique Fibonacci representation (b1,b2,…,bn) suc原创 2020-08-01 11:48:28 · 596 阅读 · 0 评论 -
2020 HDU多校 第二场 10-Lead of Wisdom(dfs + 剪枝)
题目链接: 10-Lead of WisdomDescription题意:给n把武器,每种武器只能选一件,每件武器有四个属性值,更具属性值之和的乘积计算伤害值,选出伤害值最大的武器搭配In an online game, “Lead of Wisdom” is a place where the lucky player can randomly get powerful items.There are k types of items, a player can wear at most one原创 2020-08-01 09:25:30 · 266 阅读 · 0 评论 -
2020 HDU多校 第一场 04-Distinct Sub-palindromes(思维)
题目链接: 04-Distinct Sub-palindromesDescription题意:给定n,求长度为n的字符串中包含的不同次回文串的数目的最大值S is a string of length n. S consists of lowercase English alphabets.Your task is to count the number of different S with the minimum number of distinct sub-palindromes. Sub-p原创 2020-07-27 10:50:12 · 228 阅读 · 0 评论 -
2020牛客多校 第四场 B-Basic Gcd Problem (数论 + 线性筛 + 快速幂)
题目链接: B-Basic Gcd ProblemDescription题意:给出n, c,求c的n的质因数个数的次方As a great ACMer, ZYB is also good at math and number theory.ZYB constructs a function fc(x) .such that:Give some positive integer pairs (ni,cc), ZYB wants to know f {ci}(ni)/mod(109+7).Inp原创 2020-07-24 23:11:58 · 237 阅读 · 0 评论 -
2020牛客多校 第三场 C-Operation Love (几何 + 顺逆时针判断)
题目链接: C-Operation LoveDescription题意:给出机器人手掌的n个点,判断是左手还是右手Alice is a beauty in a robot society. So many robots want to marry her. Alice determines to marry a robot who can solve the following puzzle:Firstly, the shape of Alice’s right palm is as follow:原创 2020-07-24 08:26:38 · 570 阅读 · 0 评论 -
2020牛客多校 第三场 B-Classical String Problem (字符串 + 指针维护)
题目链接: B-Classical String ProblemDescription题意:给出一个字符串,进行q次操作,输出A操作的结果Given a string S consists of lower case letters. You’re going to perform Q operations one by one. Each operation can be one of the following two types:Modify: Given an integer x. You原创 2020-07-22 23:44:36 · 338 阅读 · 0 评论 -
2020牛客多校 第三场 A-Clam and Fish (贪心 + 模拟)
题目链接: A-Clam and FishDescription题意:给出四种状态,可以执行四种操作,求获取的最大鱼的数量。There is a fishing game as following:The game contains nn stages, numbered from 1 to n.There are four types of stages (numbered from 0 to 3):type 0: There are no fish and no clam in this原创 2020-07-21 23:49:11 · 500 阅读 · 0 评论 -
2020牛客多校 第二场 F-Fake Maxpooling (快速lcm + 二维单调队列)
题目链接: F-Fake MaxpoolingDescription给出 n, m, k 求矩阵 a[n][m] 中 k方阵大小的区域内的最大值的和,a[i][j] = lcm(i, j)。Sample Input3 4 2Sample Output38More Info1 <= n, m <= 50001 <= k <= {n, m}Method可以暴力产生最小公倍数矩阵,可以花费时间换空间; 我就是补题的时候因为空间被卡的,蒟蒻哭泣也可以用空间换时间原创 2020-07-20 21:41:28 · 265 阅读 · 0 评论 -
2020牛客多校 第二场 B-Boundary (枚举 + 克莱姆法则)
题目链接: B-BoundaryDescription给出一些点,找出一个过原点的圆可以经过这些点的最多的点数Sample Input41 10 22 02 2Sample Output3Method保存输入的所有点枚举任意两个点与原点组成两条线段垂直平分线的交点即为经过这三个点的圆的圆心利用 克莱姆法则 找出所有圆心并保存找到圆心相等数量最多的圆心即为所求圆利用 (n-1)*n / 2 = ans_point 求得 nCode#include <iostre原创 2020-07-19 09:46:13 · 269 阅读 · 0 评论 -
2020牛客多校 第一场 F-Infinite String Comparision (蒟蒻补题555)
DescriptionFor a string x, Bobo defines x∞ = xxx… , which is repeats for infinite times, resulting in a string of infinite length.Bobo has two strings a and b. Find out the result comparing a∞and b∞ in lexicographical order.You can refer the wiki page原创 2020-07-17 09:23:22 · 294 阅读 · 0 评论