07 2018 档案
摘要:Iahub wants to meet his girlfriend Iahubina. They both live in Ox axis (the horizontal axis). Iahub lives at point 0 and Iahubina at point d. Iahub ha
阅读全文
摘要:There are less than 60 years left till the 900-th birthday anniversary of a famous Italian mathematician Leonardo Fibonacci. Of course, such important
阅读全文
摘要:题目描述 Petya loves lucky numbers very much. Everybody knows that lucky numbers are positive integers whose decimal record contains only the lucky digits
阅读全文
摘要:题目描述 On a plane are nn points ( x_{i}xi , y_{i}yi ) with integer coordinates between 00 and 10^{6}106 . The distance between the two points with num
阅读全文
摘要:Description Given a sequence, {A1, A2, ..., An} which is guaranteed A1 > A2, ..., An, you are to cut it into three sub-sequences and reverse them sepa
阅读全文
摘要:You've got an array consisting of n integers: a[1], a[2], ..., a[n]. Moreover, there are m queries, each query can be described by three integers li,
阅读全文
摘要:A and B are preparing themselves for programming contests. The University where A and B study is a set of rooms connected by corridors. Overall, the U
阅读全文
摘要:题目描述 喜欢钻研问题的JS 同学,最近又迷上了对加密方法的思考。一天,他突然想出了一种他认为是终极的加密办法:把需要加密的信息排成一圈,显然,它们有很多种不同的读法。 例如‘JSOI07’,可以读作: JSOI07 SOI07J OI07JS I07JSO 07JSOI 7JSOI0 把它们按照字
阅读全文
摘要:看来只要拼命去搞,两个月也是可以搞出来的啊~
阅读全文
摘要:小C最近学了很多最小生成树的算法,Prim算法、Kurskal算法、消圈算法等等。正当小C洋洋得意之时,小P又来泼小C冷水了。小P说,让小C求出一个无向图的次小生成树,而且这个次小生成树还得是严格次小的,也就是说:如果最小生成树选择的边集是EM,严格次小生成树选择的边集是ES,那么需要满足:(val
阅读全文
摘要:A histogram is a polygon composed of a sequence of rectangles aligned at a common base line. The rectangles have equal widths but may have different h
阅读全文
摘要:题目描述: 有一天,pqq准备去给×i×准备礼物,他有一些礼品准备包装一下,他用线将这些礼物连在一起,不同的礼物因为风格不同所以连接它们需要不同价值的线。风格差异越大,价格越大(所以两个礼物之间只有一种连接价格),当然有些礼物实在太不友好,所以有些礼物无法相连。pqq打算把所有礼物打包在一起,他不准
阅读全文
摘要:D. Alyona and a tree time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output D. Alyona and a tre
阅读全文
摘要:Alyona decided to go on a diet and went to the forest to get some apples. There she unexpectedly found a magic rooted tree with root in the vertex 1,
阅读全文
摘要:题目描述: 你有一个1到N的排列P1,P2,P3...PN,还有M对数(x1,y1),(x2,y2),....,(xM,yM),现在你可以选取任意对数,每对数可以选取任意次,然后对选择的某对数(xi,yi)进行操作,操作方式为交换xi,yi两个位置的数。最终你想要Pi=i的位置尽可能多。输出最多可以
阅读全文
摘要:题目描述: 期末考试考完了,分数也出来了,大家准备吃糖庆祝一下,为了鼓励同学们下学期能取得更好的成绩,司马红豆同学让n个同学站成一排,如果某个同学的分数比相邻的一个同学要高,那么他得到的糖果就会比这个分数较低的相邻的同学多,每个人至少能得到一个糖果。现在司马红豆想要知道最少需要多少个糖果能完成分糖任
阅读全文
摘要:N (1 ≤ N ≤ 100) cows, conveniently numbered 1..N, are participating in a programming contest. As we all know, some cows code better than others. Each
阅读全文
摘要:题目描述: 有一个oier,他有n个算法技能,每个技能有一个水平值,每个技能的水平上限都是A,设这个oier有cnt个技能达到了A, 设所有水平值的最小值为mi,那么这个oier的战斗力为cnt×Cf+mi×Cm,现在这个oier准备去提升自己的技能,他有m次提升的机会,每次提升可以选择某一个技能给
阅读全文
摘要:有一个a数组,里面有n个整数。现在要从中找到两个数字(可以是同一个) ai,aj ,使得 ai mod aj 最大并且 ai ≥ aj。 有一个a数组,里面有n个整数。现在要从中找到两个数字(可以是同一个) ai,aj ,使得 ai mod aj 最大并且 ai ≥ aj。 有一个a数组,里面有n个
阅读全文
摘要:— This is not playing but duty as allies of justice, Nii-chan! — Not allies but justice itself, Onii-chan! With hands joined, go everywhere at a speed
阅读全文
摘要:一、法雷序列(莫比乌斯反演/欧拉函数前缀和) 莫比乌斯反演: 欧拉函数前缀和: 二、组合数取模(线性求模数阶乘,阶乘逆元) 三、乘法逆元(扩展欧几里得) 四、素数个数和(线性筛素数) 五、大数求欧拉函数(sqrt(n)暴力) 六、网格的走法(卡特兰数) 七、又一个小球问题(第一类斯特林数) 八、叕一
阅读全文
摘要:We all know that any integer number n is divisible by 1 and n. That is why these two numbers are not the actual divisors of any numbers. The function
阅读全文
摘要:题目描述: 有一个 n×m的矩阵,现在准备对矩阵进行k次操作,每次操作可以二选一 1: 选择一行,给这一行的每一个数减去p,这种操作会得到的快乐值等于操作之前这一行的和 2: 选择一列,给这一列的每一个数减去p,这种操作会得到的快乐值等于操作之前这一列的和 那么问题来了,k次操作最大可能得到的和是多
阅读全文
摘要:A palindrome partition is the partitioning of a string such that each separate substring is a palindrome. For example, the string "ABACABA" could be p
阅读全文
摘要:最近在水简单DP题,遇到了两道层层递进的DP题,于是记录一下 一、最大子段和 题意: 给出一个长度为n(n<=1e5)的序列,求连续子段的最大值 比如说2 3 -4 5 的最大值是6 而 2 3 -6 7 的最大值为7 样例输入 6 5 4 3 -15 -12 13 样例输出 13 思路一(前缀和)
阅读全文