
常用技巧——桶排
Alex_McAvoy
想要成为渔夫的猎手
展开
-
常用技巧 —— 桶排
【概述】桶排的思想是一种比较重要的技巧,在由于桶排的特殊性,桶排仍需进行模拟装桶的过程,而且有时由于数据范围无法开很大的数组,需要使用 map 与其结合关于桶排:点击这里【例题】Romaji(CF-1008A):点击这里 明明的随机数(洛谷-P1059):点击这里 同题:明明的随机数(信息学奥赛一本通-T1184):点击这里 统计字符数(信息学奥赛一本通-T1187):点...原创 2019-08-07 15:48:29 · 495 阅读 · 0 评论 -
Romaji(CF-1008A)
Problem DescriptionVitya has just started learning Berlanese language. It is known that Berlanese uses the Latin alphabet. Vowel letters are "a", "o", "u", "i", and "e". Other letters are consonant...原创 2018-08-23 19:30:19 · 375 阅读 · 0 评论 -
三连击(升级版)(洛谷-P1618)
题目描述将1,2,…,9共9个数分成三组,分别组成三个三位数,且使这三个三位数的比例是A:B:C,试求出所有满足条件的三个三位数,若无解,输出“No!!!”。输入输出格式输入格式:三个数,A B C。输出格式:若干行,每行3个数字。按照每行第一个数字升序排列。输入输出样例输入样例#1:1 2 3输出样例#1:192 384 576219 438 ...原创 2018-02-28 16:49:17 · 955 阅读 · 0 评论 -
Together(AtCoder-3524)
Problem DescriptionYou are given an integer sequence of length N, a1,a2,…,aN.For each 1≤i≤N, you have three choices: add 1 to ai, subtract 1 from ai or do nothing.After these operations, you se...原创 2019-06-21 13:45:51 · 453 阅读 · 0 评论 -
Not so Diverse(AtCoder-3719)
Problem DescriptionTakahashi has N balls. Initially, an integer Ai is written on the i-th ball.He would like to rewrite the integer on some balls so that there are at most K different integers wr...原创 2019-07-01 15:37:45 · 393 阅读 · 0 评论 -
锯木棍(51Nod-2143)
题目有一根粗细均匀长度为 LL 的木棍,先用红颜色刻度线将它 m 等分,再用蓝色刻度线将其 n 等分(m>n),然后按所有刻度线将该木棍锯成小段,计算并输出长度最长的木棍的长度和棍数。输入输入仅有一行,包含三个正整数 L,m 和 n,两两之间用一个空格分隔。(1≤L≤100000)输出输出包含两个正整数 a 和 k,分别表示最长木棍的长度和根数。(为了简化题目的难度,所...原创 2019-07-24 11:30:46 · 2190 阅读 · 1 评论 -
顺子(51Nod-2510)
题目小b有n张牌。现在她想把牌分组,使得每组都是长度为W的顺子,即由连续W个数组成。请问小b能做到吗?输入第一行输入一个数n,表示手牌张数;第二行输入n个非负整数,表示每张牌的数字,以空格隔开;第三行输入一个数,表示每组大小W;其中1≤W≤n≤10000,任意牌的数字hand[i]满足0≤hand[i]≤10^9输出可以分组,输出“true”;不能分组,输出...原创 2019-05-13 14:56:00 · 551 阅读 · 0 评论 -
一维战舰(51Nod-1521)
题目爱丽丝和鲍博喜欢玩一维战舰的游戏。他们在一行有n个方格的纸上玩这个游戏(也就是1×n的表格)。在游戏开始的时候,爱丽丝放k个战舰在这个表格中,并不把具体位置告诉鲍博。每一只战舰的形状是 1×a 的长方形(也就是说,战舰会占据a个连续的方格)。这些战舰不能相互重叠,也不能相接触。然后鲍博会做一系列的点名。当他点到某个格子的时候,爱丽丝会告诉他那个格子是否被某只战舰占据。如果是,就说...原创 2019-04-22 22:29:53 · 272 阅读 · 0 评论 -
Two-gram(CF-977B)
Problem DescriptionTwo-gram is an ordered pair (i.e. string of length two) of capital Latin letters. For example, "AZ", "AA", "ZA" — three distinct two-grams.You are given a string sconsisting o...原创 2018-08-09 17:19:53 · 460 阅读 · 0 评论 -
Card Eater(AtCoder-2299)
Problem DescriptionSnuke has decided to play a game using cards. He has a deck consisting of N cards. On the i-th card from the top, an integer Ai is written.He will perform the operation describ...原创 2019-05-30 14:48:08 · 386 阅读 · 0 评论 -
Train Seats Reservation(2017 ACM-ICPC 亚洲区(南宁赛区)网络赛 B)
Problem DescriptionYou are given a list of train stations, say from the station 1to the station 100.The passengers can order several tickets from one station to another before the train leaves t...原创 2019-08-29 10:05:54 · 155 阅读 · 0 评论 -
Good sequence(AtCoder-3725)
Problem DescriptionYou are given a sequence of positive integers of length N, a=(a1,a2,…,aN). Your objective is to remove some of the elements in a so that a will be a good sequence.Here, an sequ...原创 2019-07-06 15:20:52 · 805 阅读 · 0 评论 -
すぬけ君の塗り絵 / Snuke's Coloring(AtCoder-2068)
Problem DescriptionWe have a grid withHrows andWcolumns. At first, all cells were painted white.Snuke paintedNof these cells. Thei-th (1≤i≤N) cell he painted is the cell at theai-th row...原创 2019-05-21 13:09:25 · 401 阅读 · 0 评论 -
三连击(洛谷-P1008)
题目描述将1,2,…,9共9个数分成三组,分别组成三个三位数,且使这三个三位数构成1:2:3的比例,试求出所有满足条件的三个三位数。输入输出格式输入格式:木有输入输出格式:若干行,每行3个数字。按照每行第一个数字升序排列。输入输出样例输入样例#1:无输出样例#1:192 384 576* * *...* * *(输出被和谐了)源代码 ...原创 2018-02-03 14:35:12 · 9019 阅读 · 10 评论 -
Planning The Expedition(CF-1011B)
Problem DescriptionNatasha is planning an expedition to Mars for n people. One of the important tasks is to provide food for each participant.The warehouse has mm daily food packages. Each packag...原创 2018-08-15 15:21:41 · 225 阅读 · 0 评论 -
Romeo Meets Juliet(POJ-2189)
Problem DescriptionFarmer John has two feuding herds of cattle, the Moontagues and the Cowpulets. One of the bulls in the Moontague herd, Romeo, has fallen in love with Juliet, a Cowpulet. Romeo wo...原创 2019-06-01 22:20:07 · 246 阅读 · 0 评论 -
Again Array Queries(LightOJ-1100)
Problem DescriptionGiven an array with n integers, and you are given two indices i and j (i ≠ j) in the array. You have to find two integers in the range whose difference is minimum. You have to pr...原创 2019-01-21 22:23:13 · 314 阅读 · 0 评论 -
こだわり者いろはちゃん / Iroha's Obsession(AtCoder-1973)
Problem DescriptionIroha is very particular about numbers. There areKdigits that she dislikes:D1,D2,…,DK.She is shopping, and now paying at the cashier. Her total isNyen (the currency of Jap...原创 2019-05-18 20:46:31 · 2514 阅读 · 2 评论 -
Little Elephant and Numbers(CF-221B)
Problem DescriptionThe Little Elephant loves numbers.He has a positive integer x. The Little Elephant wants to find the number of positive integers d, such that d is the divisor of x, and x and d...原创 2019-07-25 09:20:19 · 290 阅读 · 0 评论 -
明明的随机数(洛谷-P1059)
题目描述明明想在学校中请一些同学一起做一项问卷调查,为了实验的客观性,他先用计算机生成了N个1到1000之间的随机整数(N≤100),对于其中重复的数字,只保留一个,把其余相同的数去掉,不同的数对应着不同的学生的学号。然后再把这些数从小到大排序,按照排好的顺序去找同学做调查。请你协助明明完成“去重”与“排序”的工作。输入输出格式输入格式:输入有2行,第1行为1个正整数,表示所生成...原创 2018-04-10 22:51:06 · 1297 阅读 · 0 评论 -
明明的随机数(信息学奥赛一本通-T1184)
【题目描述】明明想在学校中请一些同学一起做一项问卷调查,为了实验的客观性,他先用计算机生成了N个1到1000之间的随机整数(N≤100),对于其中重复的数字,只保留一个,把其余相同的数去掉,不同的数对应着不同的学生的学号。然后再把这些数从小到大排序,按照排好的顺序去找同学做调查。请你协助明明完成“去重”与“排序”的工作。【输入】有2行,第1行为1个正整数,表示所生成的随机数的个数:N...原创 2018-04-22 21:32:52 · 7948 阅读 · 3 评论 -
统计字符数(信息学奥赛一本通-T1187)
【题目描述】给定一个由a-z这26个字符组成的字符串,统计其中哪个字符出现的次数最多。【输入】输入包含一行,一个字符串,长度不超过1000。【输出】输出一行,包括出现次数最多的字符和该字符出现的次数,中间以一个空格分开。如果有多个字符出现的次数相同且最多,那么输出ascii码最小的那一个字符。【输入样例】abbccc【输出样例】c 3【源程序】#i...原创 2018-04-22 21:36:19 · 6786 阅读 · 2 评论 -
处女座点名
【题目描述】处女座觉得自己手上的经费可能不太够,于是决定给牛逼学生们带家教。一天他去上课用自己的火眼金睛感觉教室里有一个学生没有来,于是他就叫学生们报出自己的学号。已知这个班上的学号是从1开始连续编号的,处女座告诉你这个班上有多少人,想问问你到底是谁没有来。【输入描述】输入数据共两行,第一行为一个整数N,表示班上的学生数量。第二行为一行N-1个整数,表示已经来的学生的学号...原创 2019-04-16 08:39:19 · 262 阅读 · 0 评论 -
Sonya and Robots(CF-1004C)
Problem DescriptionSince Sonya is interested in robotics too, she decided to construct robots that will read and recognize numbers.Sonya has drawn nn numbers in a row, aiai is located in the ii-t...原创 2018-08-26 18:36:42 · 294 阅读 · 0 评论 -
校门外的树(洛谷-P1047)
题目描述某校大门外长度为L的马路上有一排树,每两棵相邻的树之间的间隔都是1米。我们可以把马路看成一个数轴,马路的一端在数轴0的位置,另一端在L的位置;数轴上的每个整数点,即0,1,2,……,L,都种有一棵树。由于马路上有一些区域要用来建地铁。这些区域用它们在数轴上的起始点和终止点表示。已知任一区域的起始点和终止点的坐标都是整数,区域之间可能有重合的部分。现在要把这些区域中的树(包括区域端...原创 2018-02-04 03:18:10 · 1118 阅读 · 0 评论 -
Points in Segments(CF-1015A)
Problem DescriptionYou are given a set of n segments on the axis Ox, each segment has integer endpoints between 1 and mm inclusive. Segments may intersect, overlap or even coincide with each other....原创 2018-08-06 08:35:43 · 392 阅读 · 0 评论 -
Equal Sums(CF-988C)
Problem DescriptionYou are given k sequences of integers. The length of the i-th sequence equals to nini.You have to choose exactly two sequences iand j(i≠j) such that you can remove exactly on...原创 2018-08-07 19:10:16 · 330 阅读 · 0 评论