10 2018 档案
摘要:题意:给出,三个函数,h,b,a,然后T次询问,每次给出n,求sqrt(an); 思路:不会推,但是感觉a应该是线性的,这个时候我们就可以用BM线性递推,自己求出前几项,然后放到模板里,就可以求了。 数据范围在1e15,1000组都可以秒过。 ( 那么主要的问题就是得确保是线性的,而且得求出前几项。
阅读全文
摘要:现在给你一个长度为n的整数序列,其中有一些数已经模糊不清了,现在请你任意确定这些整数的值, 使得最长上升子序列最长。(为何最长呢?因为hxy向来对自己的rp很有信心) Input 第一行一个正整数n 接下来n行第i行格式如下 K x:表示第i个数可以辨认且这个数为x N:表示第i个数一个已经辨认不清
阅读全文
摘要:一个包含四个点的完全图,可以在任意节点出发,可以在任意节点结束,给出每个点被经过的次数,求有多少种合法的遍历序列。如果两个序列至少有一位是不同的,则认为它们不相同。 Input Sample Output 题意:给a个A,b个B,c个C,d个D,求有少种排列,使得相邻的两个不同。 思路:用容斥来做,
阅读全文
摘要:As we know, Rikka is poor at math. Yuta is worrying about this situation, so he gives Rikka some math tasks to practice. There is one of them: Yuta ha
阅读全文
摘要:A thief made his way to a shop. As usual he has his lucky knapsack with him. The knapsack can contain k objects. There are n kinds of products in the
阅读全文
摘要:There is a connected undirected graph with weights on its edges. It is guaranteed that each edge appears in at most one simple cycle. Assuming that th
阅读全文
摘要:Samwell Tarly is learning to draw a magical matrix to protect himself from the White Walkers. the magical matrix is a matrix with n rows and m columns
阅读全文
摘要:【BZOJ3622】已经没有什么好害怕的了 Description Input Output Sample Input 4 2 5 35 15 45 40 20 10 30 Sample Output 4 HINT 输入的2*n个数字保证全不相同。 输入的2*n个数字保证全不相同。 题意:给定a数组
阅读全文
摘要:Recently, TeaTree acquire new knoledge gcd (Greatest Common Divisor), now she want to test you. As we know, TeaTree is a tree and her root is node 1,
阅读全文
摘要:Declare: k=∑ m i=1 φ(i∗n) mod 1000000007 k=∑i=1mφ(i∗n) mod 1000000007 n n is a square-free number. φ φ is the Euler's totient function. find: ans=k k
阅读全文
摘要:There are n n apples on a tree, numbered from 1 1 to n n . Count the number of ways to pick at most m m apples. InputThe first line of the input conta
阅读全文
摘要:题目网站: http://acm.hdu.edu.cn/listproblem.php?vol=11 输入输出的对比: HDU2000: HDU2001: HDU1001: HDU2002: HDU2003: HDU2010: 2008:
阅读全文
摘要:Yellowstar likes integers so much that he listed all positive integers in ascending order,but he hates those numbers which can be written as a^b (a, b
阅读全文
摘要:Tom owns a company and he is the boss. There are n staffs which are numbered from 1 to n in this company, and every staff has a ability. Now, Tom is g
阅读全文
摘要:第一阶段:先刷水题,水题,就是几乎不牵扯算法。需要自己想方法解决。这样的题,一是锻炼逻辑和思维的严谨,二是锻炼代码能力。一般做到60-200题左右。 第二阶段:渐渐的学一些简单的算法,或者专题训练,或者打比赛积累经验。第二阶段刷到400题。 第三阶段: 在第二阶段的基础上继续纠结算法。 这时候可以看
阅读全文
摘要:题面太丑了,就不复制了。 题意:F1=A; F2=B; Fn=D*Fn-1+C*Fn-2+P/i;求Fn。 思路:根据P/i的值划分区间,每个区间矩阵求。 带常数的矩阵:
阅读全文
摘要:There are n numbers 3^0, 3^1, . . . , 3^n-1. Each time you can choose a subset of them (may be empty), and then add them up. Count how many numbers ca
阅读全文
摘要:Senior Pan fails in his discrete math exam again. So he asks Master ZKC to give him graph theory problems everyday. The task is simple : ZKC will give
阅读全文
摘要:There is a tree having N vertices. In the tree there are K monkeys (K <= N). A vertex can be occupied by at most one monkey. They want to remove some
阅读全文
摘要:Do you like painting? Little D doesn't like painting, especially messy color paintings. Now Little B is painting. To prevent him from drawing messy pa
阅读全文
摘要:Bob's school has a big playground, boys and girls always play games here after school. To protect boys and girls from getting hurt when playing happil
阅读全文
摘要:Kelukin is a businessman. Every day, he travels around cities to do some business. On August 17th, in memory of a great man, citizens will read a book
阅读全文
摘要:One day, Kaitou Kiddo had stolen a priceless diamond ring. But detective Conan blocked Kiddo's path to escape from the museum. But Kiddo didn't want t
阅读全文
摘要:There are N schedules, the i-th schedule has start time s i si and end time e i ei (1 <= i <= N). There are some machines. Each two overlapping schedu
阅读全文
摘要:There is a nonnegative integer sequence a 1...n a1...n of length n n . HazelFan wants to do a type of transformation called prefix-XOR, which means a
阅读全文
摘要:Bob has a dictionary with N words in it. Now there is a list of words in which the middle part of the word has continuous letters disappeared. The mid
阅读全文
摘要:We define the distance of two strings A and B with same length n is dis A,B =∑ i=0 n−1 |A i −B n−1−i | disA,B=∑i=0n−1|Ai−Bn−1−i| The difference betwee
阅读全文
摘要:Give an array A, the index starts from 1. Now we want to know B i =max i∤j A j Bi=maxi∤jAj , i≥2 i≥2 . InputThe first line of the input gives the numb
阅读全文
摘要:Little Ruins is playing a number game, first he chooses two positive integers yy and KK and calculates f(y,K)f(y,K), here f(y,K)=∑z in every digits of
阅读全文
摘要:题目描述 阿尔比恩王国(the Albion Kingdom)潜伏着一群代号“白鸽队(Team White Pigeon)”的间谍。在没有任务的时候,她们会进行各种各样的训练,比如快速判断一个文档有没有语法错误,这有助于她们鉴别写文档的人受教育程度。 这次用于训练的是一个含有n个括号的文档。括号一共
阅读全文
摘要:Nim is a mathematical game of strategy in which two players take turns removing objects from distinct heaps. On each turn, a player must remove at lea
阅读全文
摘要:As you know, the game of "Nim" is played with n piles of stones, where the i-th pile initially contains ai stones. Two players alternate the turns. Du
阅读全文