nexthexonextbutterflyvolantisyearnyiliashokaindigoapollolandscapecactusmateryicarusfluidmaterial nameDZY Loves Fibonacci Numbers discriptiontime limit per test:4 secondsmemory limit per test:256 megabytesIn mathematical terms, the sequence $F_n$ of Fibonacci numbers is defined by the recurrence...

nexthexonextbutterflyvolantisyearnyiliashokaindigoapollolandscapecactusmateryicarusfluidmaterial ###nameNonsense Time ###descriptionYou a given a permutation $p_1,p_2,…,p_n$ of size n. Initially, all elements in p are frozen. There will be n stages that these elements will become available one by...

nexthexonextbutterflyvolantisyearnyiliashokaindigoapollolandscapecactusmateryicarusfluidmaterial ###namePair ###descirptionGiven three integers A, B, C. Count the number of pairs <x,y> (with1≤x≤A and 1≤y≤B)such that at least one of the following is true: (x and y) > C (x xor...

nexthexonextbutterflyvolantisyearnyiliashokaindigoapollolandscapecactusmateryicarusfluidmaterial ###nameFind the median ###descirptionLet median of some array be the number which would stand in the middle of this array if it was sorted beforehand. If the array has even length let median be smallest...

nexthexonextbutterflyvolantisyearnyiliashokaindigoapollolandscapecactusmateryicarusfluidmaterial 给你两个分数,让你找一个分数在他们俩之间,要求分母最小, 这个问题很显然,我们应该转移到Stern Brocot...

nexthexonextbutterflyvolantisyearnyiliashokaindigoapollolandscapecactusmateryicarusfluidmaterial ###namefraction ###descirptionMany problems require printing the probability of something. Moreover, it is common that if the answer is $\frac{a}{b}$, you should output $a×b^{−1}(modp)$ (p is a...

nexthexonextbutterflyvolantisyearnyiliashokaindigoapollolandscapecactusmateryicarusfluidmaterial ###name病毒 ###descirption二进制病毒审查委员会最近发现了如下的规律:某些确定的二进制串是病毒的代码。如果某段代码中不存在任何一段病毒代码,那么我们就称这段代码是安全的。现在委员会已经找出了所有的病毒代码段,试问,是否存在一个无限长的安全的二进制代码。 示例:例如如果{011, 11, 00000}为病毒代码段,那么一个可能的无限长安全代码就是010101…。如果{01, 11,...

nexthexonextbutterflyvolantisyearnyiliashokaindigoapollolandscapecactusmateryicarusfluidmaterial ###namethree arrays ###descirptionThere are three integer arrays a,b,c. The lengths of them are all N. You are given the full contents of a and b. And the elements in c is produced by following...

nexthexonextbutterflyvolantisyearnyiliashokaindigoapollolandscapecactusmateryicarusfluidmaterial 转移自老blog 51NOD1009 链接 https://www.51nod.com/Challenge/Problem.html#!#problemId=1009 题意         题意就是求1-n之内出现过多少个1,比如11出现两次,112出...

nexthexonextbutterflyvolantisyearnyiliashokaindigoapollolandscapecactusmateryicarusfluidmaterial 转移自老blog 51NOD1055 链接 https://www.51nod.com/Challenge/Problem.html#!#problemId=1055 题意         N个不同的正整数A[i],找出由这些数组成的最长的等差数列。N...