09 2018 档案
摘要:XOR is a kind of bit operator, we define that as follow: for two binary base number A and B, let C=A XOR B, then for each bit of C, we can get its val
阅读全文
摘要:相传,在远古时期,位于西方大陆的 Magic Land 上,人们已经掌握了用魔法矿石炼制法杖的技术。那时人们就认识到,一个法杖的法力取决于使用的矿石。一般地,矿石越多则法力越强,但物极必反:有时,人们为了获取更强的法力而使用了很多矿石,却在炼制过程中发现魔法矿石全部消失了,从而无法炼制出法杖,这个现
阅读全文
摘要:One day Silence is interested in revolving the digits of a positive integer. In the revolving operation, he can put several last digits to the front o
阅读全文
摘要:Give you a string with length N, you can generate N strings by left shifts. For example let consider the string “SKYLONG”, we can generate seven strin
阅读全文
摘要:Alice are given an array A[1..N]A[1..N] with NN numbers. Now Alice want to build an array BB by a parameter KK as following rules: Initially, the arra
阅读全文
摘要:Bob intends to color the nodes of a tree with a pen. The tree consists of NN nodes. These nodes are numbered 1,2,...,N1,2,...,N. The root of the tree
阅读全文
摘要:Alice is interesting in computation geometry problem recently. She found a interesting problem and solved it easily. Now she will give this problem to
阅读全文
摘要:题意:T组样例,给次给出一个N节点的点权树,以及M,问连通块的点权和sum的情况,输出sum=1到M,用0或者1表示。 思路:背包,N^2,由于是无向的连通块,所以可以用分治优化到NlgN。 然后背包可以用bitset优化。注意不要想着背包合并背包,背包只能合并单点。
阅读全文
摘要:You are given a string ss. You should answer nn queries. The ii-th query consists of integer kiki and string mimi. The answer for this query is the mi
阅读全文
摘要:题意:给定N个节点,K次操作,操作有两种,1是合并两个集合,2是求某个集合的第K大(从小到大排序)。 思路:合并只要启发式即可。此题可以用线段树,保存1到N的排序的出现次数和。 复杂度O(NlogN)。想象一下,当其中一棵树节点少的时候,复杂度是O(logN)的,次数不超过N次;当两棵树的节点都蛮多
阅读全文
摘要: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
阅读全文
摘要:题意:给出N,K,M,P。求有多少长度为K的序列A,满足:(1)首项为正整数;(2)递增数列;(3)相邻两项的差小于等于m;(4)最后一个数小于等于N。 思路:根据差分来算数量。
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要:有M个球,一开始每个球均有一个初始标号,标号范围为1~N且为整数,标号为i的球有ai个,并保证Σai = M。 每次操作等概率取出一个球(即取出每个球的概率均为1/M),若这个球标号为k(k < N),则将它重新标号为k + 1;若这个球标号为N,则将其重标号为1。(取出球后并不将其丢弃) 现在你需
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要:题意:输入N,输出fib(2^N)%1125899839733759。(P=1125899839733759是素数) 思路:欧拉降幂,因为可以表示为矩阵乘法,2^N在幂的位置,矩阵乘法也可以降幂,所以有ans=a*base^num; num=2^N%(P-1)。
阅读全文
摘要: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
阅读全文
摘要:Perhaps the sea‘s definition of a shell is the pearl. However, in my view, a shell necklace with n beautiful shells contains the most sincere feeling
阅读全文
摘要:There are well-known formulas: , , . Also mathematicians found similar formulas for higher degrees. Find the value of the sum modulo 109 + 7 (so you s
阅读全文
摘要:Tiny Wong the chef used to be a mathematics teacher in a senior high school. At that time, he always used to tell his students that when there is a sq
阅读全文
摘要:Let's call a non-empty sequence of positive integers a1, a2... ak coprime if the greatest common divisor of all elements of this sequence is equal to
阅读全文
摘要:You are given n points on Cartesian plane. Every point is a lattice point (i. e. both of its coordinates are integers), and all points are distinct. Y
阅读全文
摘要:Little Petya likes to draw. He drew N red and M blue points on the plane in such a way that no three points lie on the same line. Now he wonders what
阅读全文
摘要:题意:给定N个点,用矩形将所有点覆盖,要求矩形宽度最小。 思路:裸体,旋转卡壳去rotate即可。 最远距离是点到点;宽度是点到边。
阅读全文
摘要:You are given n points with integer coordinates on the plane. Points are given in a way such that there is no triangle, formed by any three of these n
阅读全文
摘要:Given n distinct points on a plane, your task is to find the triangle that have the maximum area, whose vertices are from the given points. Input The
阅读全文
摘要:Bessie, Farmer John's prize cow, has just won first place in a bovine beauty contest, earning the title 'Miss Cow World'. As a result, Bessie will mak
阅读全文
摘要:不好排版,直接转移去: https://blog.csdn.net/wang_heng199/article/details/74477738 一、目录 一些历史: 1978年, M.I. Shamos's Ph.D. 的论文"Computational Geometry"标志着计算机科学的这一领域
阅读全文
摘要:Count the number of distinct sequences a1, a2, ..., an (1 ≤ ai) consisting of positive integers such that gcd(a1, a2, ..., an) = x and . As this numbe
阅读全文
摘要:Lakhesh loves to make movies, so Nephren helps her run a cinema. We may call it No. 68 Cinema. However, one day, the No. 68 Cinema runs out of changes
阅读全文
摘要:因为凛冬将至,所以自己主要针对自己以前比较擅长但是已经忘记的部分。 2018-09-04:数学专题-数论。 2018-09-05:数学专题-几何。 2018-09-06:分治,树上分治,CDQ。 2018-09-07:数据结构-平衡树,LCT。 2018-09-08:数学专题-概率。 2018-09
阅读全文
摘要:Ivan had string s consisting of small English letters. However, his friend Julia decided to make fun of him and hid the string s. Ivan preferred makin
阅读全文