03 2020 档案
摘要:卡了巨长时间,照着别人的博客总算一点一点改对了TAT,对树形分组背包模板改写一下,有时间的话再补细节。 参考博客:https://blog.csdn.net/qq_40531479/article/details/103211677?depth_1-utm_source=distribute.pc_
阅读全文
摘要:题目描述 小A的工作不仅繁琐,更有苛刻的规定,要求小A每天早上在6:00之前到达公司,否则这个月工资清零。可是小A偏偏又有赖床的坏毛病。于是为了保住自己的工资,小A买了一个十分牛B的空间跑路器,每秒钟可以跑2^k千米(k是任意自然数)。当然,这个机器是用longint存的,所以总跑路长度不能超过ma
阅读全文
摘要:题目背景 题目描述: 每天,农夫 John 的N(1 <= N <= 50,000)头牛总是按同一序列排队. 有一天, John 决定让一些牛们玩一场飞盘比赛. 他准备找一群在对列中为置连续的牛来进行比赛. 但是为了避免水平悬殊,牛的身高不应该相差太大. John 准备了Q (1 <= Q <= 1
阅读全文
摘要:Advanced CPU Manufacturer (ACM) is one of the best CPU manufacturer in the world. Every day, they manufacture n CPU chips and sell them all over the w
阅读全文
摘要:有时候快排/归并之类并不简简单单只是排序,比如快排可以求第k大,归并在部分已排序的情况下效率较高不容易被卡~ #include <bits/stdc++.h> using namespace std; void merge(int a[], int l, int r, int mid) { int
阅读全文
摘要:Vova had a pretty weird sleeping schedule. There are hh hours in a day. Vova will sleep exactly nn times. The ii -th time he will sleep exactly after
阅读全文
摘要:The next lecture in a high school requires two topics to be discussed. The ii -th topic is interesting by aiai units for the teacher and by bibi units
阅读全文
摘要:There is a frog staying to the left of the string s=s1s2…sns=s1s2…sn consisting of nn characters (to be more precise, the frog initially stays at the
阅读全文
摘要:Problem Statement Snuke has decided to play a game using cards. He has a deck consisting of NN cards. On the ii -th card from the top, an integer AiAi
阅读全文
摘要:题目背景 BBB地区在地震过后,所有村庄都造成了一定的损毁,而这场地震却没对公路造成什么影响。但是在村庄重建好之前,所有与未重建完成的村庄的公路均无法通车。换句话说,只有连接着两个重建完成的村庄的公路才能通车,只能到达重建完成的村庄。 题目描述 给出BBB地区的村庄数NNN,村庄编号从000到N−1
阅读全文
摘要:The round carousel consists of nn figures of animals. Figures are numbered from 11 to nn in order of the carousel moving. Thus, after the nn -th figur
阅读全文
摘要:A number is ternary if it contains only digits 00 , 11 and 22 . For example, the following numbers are ternary: 10221022 , 1111 , 2121 , 20022002 . Yo
阅读全文
摘要:For the given integer nn (n>2n>2 ) let's write down all the strings of length nn which contain n−2n−2 letters 'a' and two letters 'b' in lexicographic
阅读全文
摘要:You are given two positive integers aa and bb. In one move you can increase aa by 11 (replace aa with a+1a+1). Your task is to find the minimum number
阅读全文
摘要:Trees are an important component of the natural landscape because of their prevention of erosion and the provision of a specific ather-sheltered ecosy
阅读全文
摘要:题目描述 有一棵苹果树,如果树枝有分叉,一定是分2叉(就是说没有只有1个儿子的结点) 这棵树共有N个结点(叶子点或者树枝分叉点),编号为1-N,树根编号一定是1。 我们用一根树枝两端连接的结点的编号来描述一根树枝的位置。下面是一颗有4个树枝的树 2 5 \ / 3 4 \ / 1 现在这颗树枝条太多
阅读全文
摘要:题目描述 小明对数学饱有兴趣,并且是个勤奋好学的学生,总是在课后留在教室向老师请教一些问题。一天他早晨骑车去上课,路上见到一个老伯正在修剪花花草草,顿时想到了一个有关修剪花卉的问题。于是当日课后,小明就向老师提出了这个问题: 一株奇怪的花卉,上面共连有NN N朵花,共有N−1N-1N−1条枝干将花儿
阅读全文
摘要:题目描述 一场可怕的地震后,人们用N个牲口棚(1≤N≤150,编号1..N)重建了农夫John的牧场。由于人们没有时间建设多余的道路,所以现在从一个牲口棚到另一个牲口棚的道路是惟一的。因此,牧场运输系统可以被构建成一棵树。John想要知道另一次地震会造成多严重的破坏。有些道路一旦被毁坏,就会使一棵含
阅读全文
摘要:E. Count The Blocks time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You wrote down all i
阅读全文
摘要:Petya has a rectangular Board of size n×mn×m . Initially, kk chips are placed on the board, ii -th chip is located in the cell at the intersection of
阅读全文
摘要:The King of Berland Polycarp LXXXIV has nn daughters. To establish his power to the neighbouring kingdoms he wants to marry his daughters to the princ
阅读全文
摘要:You are given two integers nn and kk. Your task is to find if nn can be represented as a sum of kk distinct positive odd (not divisible by 22) integer
阅读全文
摘要:题目描述 在大学里每个学生,为了达到一定的学分,必须从很多课程里选择一些课程来学习,在课程里有些课程必须在某些课程之前学习,如高等数学总是在其它课程之前学习。现在有 NNN 门功课,每门课有个学分,每门课有一门或没有直接先修课(若课程a是课程b的先修课即只有学完了课程a,才能学习课程b)。一个学生要
阅读全文
摘要:题目背景 随着新版百度空间的上线,Blog 宠物绿豆蛙完成了它的使命,去寻找它新的归宿。 题目描述 给出张 nnn 个点 mmm 条边的有向无环图,起点为 111,终点为 nnn,每条边都有一个长度,并且从起点出发能够到达所有的点,所有的点也都能够到达终点。 绿豆蛙从起点出发,走向终点。 到达每一个
阅读全文
摘要:Problem Statement There is a cave consisting of NN rooms and MM one-directional passages. The rooms are numbered 11 through NN . Takahashi is now in R
阅读全文
摘要:Problem Statement Takahashi will take part in an eating contest. Teams of NN members will compete in this contest, and Takahashi's team consists of NN
阅读全文
摘要:题目描述 某大学有 nnn 个职员,编号为 1…n1\ldots n1…n。 他们之间有从属关系,也就是说他们的关系就像一棵以校长为根的树,父结点就是子结点的直接上司。 现在有个周年庆宴会,宴会每邀请来一个职员都会增加一定的快乐指数 rir_iri,但是呢,如果某个职员的直接上司来参加舞会了,那么
阅读全文
摘要:There are two strings A and B with equal length. Both strings are made up of lower case letters. Now you have a powerful string painter. With the help
阅读全文
摘要:The multiplication puzzle is played with a row of cards, each containing a single positive integer. During the move player takes one card out of the r
阅读全文
摘要:Once Petya read a problem about a bracket sequence. He gave it much thought but didn't find a solution. Today you will face it. You are given string s
阅读全文
摘要:We give the following inductive definition of a “regular brackets” sequence: the empty sequence is a regular brackets sequence, if s is a regular brac
阅读全文
摘要:Gappu has a very busy weekend ahead of him. Because, next weekend is Halloween, and he is planning to attend as many parties as he can. Since it's Hal
阅读全文
摘要:题目描述 在一个圆形操场的四周摆放 NNN 堆石子,现要将石子有次序地合并成一堆.规定每次只能选相邻的2堆合并成新的一堆,并将新的一堆的石子数,记为该次合并的得分。 试设计出一个算法,计算出将 NNN 堆石子合并成 111 堆的最小得分和最大得分。 输入格式 数据的第 111 行是正整数 NNN,表
阅读全文
摘要:Description 在科学计算中经常要计算矩阵的乘积。矩阵A和B可乘的条件是矩阵A的列数等于矩阵B的行数。若A是一个p×q的矩阵,B是一个q×r的矩阵,则其乘积C=AB是一个p×r的矩阵。 由公式知计算C=AB总共需要pqr次的数乘。 为了说明在计算矩阵连乘积时加括号方式对整个计算量的影响,我们
阅读全文
摘要:You are given a tree consisting of nn nodes. You want to write some labels on the tree's edges such that the following conditions hold: Every label is
阅读全文
摘要:Ehab has an array aa of length nn . He has just enough free time to make a new array consisting of nn copies of the old array, written back-to-back. W
阅读全文
摘要:You are given a positive integer xx . Find any such 22 positive integers aa and bb such that GCD(a,b)+LCM(a,b)=xGCD(a,b)+LCM(a,b)=x . As a reminder, G
阅读全文
摘要:题目描述 太郎有N只兔子,现在为了方便识别它们,太郎要给他们编号。兔子们向太郎表达了它们对号码的喜好,每个兔子i想要一个整数,介于1和Maxnumber[i]之间(包括1和Maxnumber[i])。当然,每个兔子的编号是不同的。现在太郎想知道一共有多少种编号的方法。 你只用输出答案mod 1000
阅读全文
摘要:题目描述 给出一个小于2322^{32}232的正整数。这个数可以用一个323232位的二进制数表示(不足323232位用000补足)。我们称这个二进制数的前161616位为“高位”,后161616位为“低位”。将它的高低位交换,我们可以得到一个新的数。试问这个新的数是多少(用十进制表示)。 例如,
阅读全文
摘要:题目描述 经过一段时间的紧张筹备,电脑小组的“RP餐厅”终于开业了,这天,经理LXC接到了一个定餐大单,可把大家乐坏了!员工们齐心协力按要求准备好了套餐正准备派送时,突然碰到一个棘手的问题,筷子!CX小朋友找出了餐厅中所有的筷子,但遗憾的是这些筷子长短不一,而我们都知道筷子需要长度一样的才能组成一双
阅读全文
摘要:题目描述 对于一个递归函数w(a,b,c)w(a,b,c)w(a,b,c) 如果a≤0a \le 0a≤0 or b≤0b \le 0b≤0 or c≤0c \le 0c≤0就返回值111. 如果a>20a>20a>20 or b>20b>20b>20 or c>20c>20c>20就返回w(20,
阅读全文
摘要:题目描述 Bessie hears that an extraordinary meteor shower is coming; reports say that these meteors will crash into earth and destroy anything they hit. A
阅读全文
摘要:题目背景 kkksc03 的大学生活非常的颓废,平时根本不学习。但是,临近期末考试,他必须要开始抱佛脚,以求不挂科。 题目描述 这次期末考试,kkksc03 需要考 444 科。因此要开始刷习题集,每科都有一个习题集,分别有 s1,s2,s3,s4s_1,s_2,s_3,s_4s1,s2,s3
阅读全文
摘要:问题描述 很久以前,T王国空前繁荣。为了更好地管理国家,王国修建了大量的快速路,用于连接首都和王国内的各大城市。 为节省经费,T国的大臣们经过思考,制定了一套优秀的修建方案,使得任何一个大城市都能从首都直接或者通过其他大城市间接到达。同时,如果不重复经过大城市,从首都到达每个大城市的方案都是唯一的。
阅读全文
摘要:问题描述 小明开了一家糖果店。他别出心裁:把水果糖包成4颗一包和7颗一包的两种。糖果不能拆包卖。 小朋友来买糖的时候,他就用这两种包装来组合。当然有些糖果数目是无法组合出来的,比如要买 10 颗糖。 你可以用计算机测试一下,在这种包装情况下,最大不能买到的数量是17。大于17的任何数字都可以用4和7
阅读全文
摘要:问题描述 小明这些天一直在思考这样一个奇怪而有趣的问题: 在1~N的某个全排列中有多少个连号区间呢?这里所说的连号区间的定义是: 如果区间[L, R] 里的所有元素(即此排列的第L个到第R个元素)递增排序后能得到一个长度为R-L+1的“连续”数列,则称这个区间连号区间。 当N很小的时候,小明可以很快
阅读全文
摘要:Suppose you are performing the following algorithm. There is an array v1,v2,…,vnv1,v2,…,vn filled with zeroes at start. The following operation is app
阅读全文
摘要:You are given an array a1,a2,…,ana1,a2,…,an . Array is good if for each pair of indexes i<ji<j the condition j−aj≠i−aij−aj≠i−ai holds. Can you shuffle
阅读全文
摘要:You are given two integers nn and mm (m<nm<n). Consider a convex regular polygon of nn vertices. Recall that a regular polygon is a polygon that is eq
阅读全文
摘要:You are given an array aa of length nn and array bb of length mm both consisting of only integers 00 and 11 . Consider a matrix cc of size n×mn×m form
阅读全文
摘要:You are given an array aa consisting of nn positive integers. Find a non-empty subset of its elements such that their sum is even (i.e. divisible by 2
阅读全文
摘要:A bracketed sequence is called correct (regular) if by inserting "+" and "1" you can get a well-formed mathematical expression from it. For example, s
阅读全文
摘要:问题描述 数轴上有n个闭区间D1,…,Dn。其中区间Di用一对整数[ai, bi]来描述,满足ai < bi。已知这些区间的长度之和至少有10000。所以,通过适当的移动这些区间,你总可以使得他们的“并”覆盖[0, 10000]——也就是说[0, 10000]这个区间内的每一个点都落于至少一个区间内
阅读全文
摘要:题目描述 科学家们在 Samuel 星球上的探险得到了丰富的能源储备,这使得空间站中大型计算机 Samuel II 的长时间运算成为了可能。由于在去年一年的辛苦工作取得了不错的成绩,小联被允许用 Samuel II 进行数学研究。 小联最近在研究和约数有关的问题,他统计每个正数 NNN 的约数的个数
阅读全文
摘要:题目描述 输入两个正整数 x0,y0x_0, y_0x0,y0,求出满足下列条件的 P,QP, QP,Q 的个数: P,QP,QP,Q 是正整数。 要求 P,QP, QP,Q 以 x0x_0x0 为最大公约数,以 y0y_0y0 为最小公倍数。 试求:满足条件的所有可能的 P,QP, QP,
阅读全文
摘要:题目描述 对一个给定的自然数MMM,求出所有的连续的自然数段,这些连续的自然数段中的全部数之和为MMM。 例子:1998+1999+2000+2001+2002=100001998+1999+2000+2001+2002 = 100001998+1999+2000+2001+2002=10000,所
阅读全文
摘要:题目描述 我们可以用这样的方式来表示一个十进制数: 将每个阿拉伯数字乘以一个以该数字所处位置为指数,以 101010 为底数的幂之和的形式。例如 123123123 可表示为 1×102+2×101+3×1001 \times 10^2+2\times 10^1+3\times 10^01×102+
阅读全文
摘要:题目描述 人类终于登上了火星的土地并且见到了神秘的火星人。人类和火星人都无法理解对方的语言,但是我们的科学家发明了一种用数字交流的方法。这种交流方法是这样的,首先,火星人把一个非常大的数字告诉人类科学家,科学家破解这个数字的含义后,再把一个很小的数字加到这个大数上面,把结果告诉火星人,作为人类的回答
阅读全文
摘要:The map of Bertown can be represented as a set of nn intersections, numbered from 11 to nn and connected by mm one-way roads. It is possible to move a
阅读全文
摘要:You are given a string ss consisting of lowercase Latin letters. Let the length of ss be |s||s| . You may perform several operations on this string. I
阅读全文
摘要:Tanya wants to go on a journey across the cities of Berland. There are nn cities situated along the main railroad line of Berland, and these cities ar
阅读全文
摘要:Polycarp is preparing the first programming contest for robots. There are nn problems in it, and a lot of robots are going to participate in it. Each
阅读全文