Live2d Test Env
上一页 1 ··· 32 33 34 35 36 37 38 39 40 ··· 101 下一页
摘要: 题意:给定N个节点,K次操作,操作有两种,1是合并两个集合,2是求某个集合的第K大(从小到大排序)。 思路:合并只要启发式即可。此题可以用线段树,保存1到N的排序的出现次数和。 复杂度O(NlogN)。想象一下,当其中一棵树节点少的时候,复杂度是O(logN)的,次数不超过N次;当两棵树的节点都蛮多 阅读全文
posted @ 2018-09-20 10:12 nimphy 阅读(301) 评论(0) 推荐(0) 编辑
摘要: Yash is finally tired of computing the length of the longest Fibonacci-ish sequence. He now plays around with more complex things such as Fibonacci-is 阅读全文
posted @ 2018-09-19 18:10 nimphy 阅读(289) 评论(0) 推荐(0) 编辑
摘要: 题意:给出N,K,M,P。求有多少长度为K的序列A,满足:(1)首项为正整数;(2)递增数列;(3)相邻两项的差小于等于m;(4)最后一个数小于等于N。 思路:根据差分来算数量。 阅读全文
posted @ 2018-09-19 16:43 nimphy 阅读(153) 评论(0) 推荐(0) 编辑
摘要: There is a sequence aa of length nn. We use aiai to denote the ii-th element in this sequence. You should do the following three types of operations t 阅读全文
posted @ 2018-09-19 15:28 nimphy 阅读(344) 评论(0) 推荐(0) 编辑
摘要: At the children's day, the child came to Picks's house, and messed his house up. Picks was angry at him. A lot of important things were lost, in parti 阅读全文
posted @ 2018-09-19 09:48 nimphy 阅读(317) 评论(0) 推荐(0) 编辑
摘要: 有M个球,一开始每个球均有一个初始标号,标号范围为1~N且为整数,标号为i的球有ai个,并保证Σai = M。 每次操作等概率取出一个球(即取出每个球的概率均为1/M),若这个球标号为k(k < N),则将它重新标号为k + 1;若这个球标号为N,则将其重标号为1。(取出球后并不将其丢弃) 现在你需 阅读全文
posted @ 2018-09-18 19:47 nimphy 阅读(366) 评论(0) 推荐(0) 编辑
摘要: On Saint Valentine's Day, Alex imagined to present a special pendant to his girl friend made by K kind of pearls. The pendant is actually a string of 阅读全文
posted @ 2018-09-18 19:26 nimphy 阅读(248) 评论(0) 推荐(0) 编辑
摘要: A cellular automaton is a collection of cells on a grid of specified shape that evolves through a number of discrete time steps according to a set of 阅读全文
posted @ 2018-09-18 16:26 nimphy 阅读(225) 评论(0) 推荐(0) 编辑
摘要: 题意:输入N,输出fib(2^N)%1125899839733759。(P=1125899839733759是素数) 思路:欧拉降幂,因为可以表示为矩阵乘法,2^N在幂的位置,矩阵乘法也可以降幂,所以有ans=a*base^num; num=2^N%(P-1)。 阅读全文
posted @ 2018-09-18 15:31 nimphy 阅读(216) 评论(0) 推荐(0) 编辑
摘要: JRY wants to drag racing along a long road. There are nn sections on the road, the ii-th section has a non-negative integer length sisi. JRY will choo 阅读全文
posted @ 2018-09-18 10:25 nimphy 阅读(442) 评论(0) 推荐(0) 编辑
上一页 1 ··· 32 33 34 35 36 37 38 39 40 ··· 101 下一页