Enumeration, simulation and sorting

Example: consecutive interval number Xiao Ming has been thinking about such a strange and interesting question these days: How many consecutive intervals are there in an arrangement of 1 ∼ N? The definition of the serial interval here is: If all the elements in the interval [L,R] (i.e. the L-th to r-th elements of this arrangement) can ...

Posted by trrobnett on Sun, 20 Feb 2022 07:25:50 +0100

Introduction to Niuke algorithm Mathematics: 1001-1006 prime numbers

0x00 topic source Special topics in Mathematics 0x10 Tag Mathematics, prime, Euler sieve 0x20 1001 prime judgment Give a number x, judge whether it is a prime number, and output all its prime factors. 0x21 prime sieve (Euler sieve) The boards are as follows: bool isnp[MAXN]; vector<int> primes; void init(int n) { for (i ...

Posted by stonefish on Mon, 14 Feb 2022 09:07:33 +0100

L3-012 fruit ninja

Title: Everyone must have played the "fruit ninja" game popular all over the world in 2010? (it doesn't matter if you haven't played ~) in the game, a series of fruits and bombs will be ejected randomly in the screen. Players can complete the tasks specified in the game by cutting off all fruits as much as possible to avoid hitting t ...

Posted by jexx on Tue, 25 Jan 2022 17:24:14 +0100

The third special training of HENAU winter camp (Mathematics)

Learning materials related to this training:         Euler function -- the number of Coprime numbers with N in numbers less than n         Game theory and algorithm implementation (three basic games)         Fast power (Java implementation code) catalogue A - A^B Mod C B - inverse element C - number of decision primes D - matrix ...

Posted by patrick99e99 on Wed, 19 Jan 2022 13:04:41 +0100

[number theory series I] C Looooops, checkers, the lucky number, cf906d, power tower, minimum power of prime, guard of honor, LCMSUM

All the number theory knowledge involved below proves portal 1 All the number theory knowledge involved below proves Portal 2 C Looooops description solution Transform the meaning of the question into a mathematical formula A + C ...

Posted by HektoR on Tue, 18 Jan 2022 07:44:38 +0100

[Loj #10168. "One book 5.3 exercise 3" hate 7 not to become a wife] solution

Title Link subject single! Still single! GIGO is still single! DS code Nong Jige is still single! Therefore, he hates Valentine's day most in his life. Whether it's \ (214 \) or \ (77 \), he hates it! GIGO observed the two numbers \ (214 \) and \ (77 \), and found that: \(2+1+4=7\) \(7+7=7×2\) \(77=7 × 11\) Finally, he found that all this was d ...

Posted by Garion on Thu, 13 Jan 2022 07:48:40 +0100

Algorithm template: prime number bucket of number theory (including detailed explanation of Ehrlich sieve method and Euler linear sieve method) [Shen Qi]

preface Just call me Shen Qi. Recently, I have gained a lot from watching the video of AcWing algorithm basic course. So I decided to open up the algorithm section and officially began to sort out the algorithm notes and clarify my ideas. This time, we brought prime bucket. Hey, hey. Each part will be matched with the corresponding exerci ...

Posted by stezz on Sat, 08 Jan 2022 13:17:40 +0100

luogu5400 CTS2019 random cube

meaning of the title n × m × l n\times m\times l n × m × l lattice cubes, filled randomly 1 1 ...

Posted by rn14 on Mon, 27 Dec 2021 12:39:06 +0100

[NOI2013] vector inner product

subject Portal to LOJ thinking This question is really, really, really, really outrageous. Better from k = 2 k=2 k=2 start. First of all, we need to think of such a thing: multiple vectors and multiple vectors, fi ...

Posted by greip on Mon, 27 Dec 2021 01:58:04 +0100

[PAT] Spring 2021 PAT Class A problems

1. Arithmetic Progression of Primes (20 points) In mathematics, an arithmetic progression (AP, equal difference column) is a sequence of numbers such that the difference between the consecutive terms is constant. In 2004, Terence Tao and Ben Green proved that for any positive n ...

Posted by ddoc on Thu, 16 Dec 2021 19:32:46 +0100