84 analog solution to a problem

A. Smooth

Consider the introduction of several new glossy smooth with the existing number.

Obviously it can be removed each time the minimum number is smooth, and the quality factor by inserting each stack.

Marking required by the hash table to solve the problem of double counting.

Complexity is $ O (kblogk) $, space should also bear.

Clearly positive solution without the $ log $.

Because every time we are out of the minimum number of smooth, in fact, heap somewhat redundant.

So think about how to get rid of this heap.

Inspired by a title earthworms, as a result of multiplying each of the prime factors is monotonically increasing.

Can start and multiplying the result by a queue pair for each quality factor, each minimum $ b $ cohorts withdrawn.

However, this does not go heavy, we have a better way.

Euler sieve, so that each composite number we are its smallest prime factor screened out.

It is possible to use the same idea, when the current out of 0 modulo a prime number equal to the number of smoothness can be done for each screen only once.

 

 

 

B. Six

See the data range, immediately wanted to like pressure.

Sequence length up to 12, does not seem difficult to do.

However, some simple like pressing died.

Thus a self-closing, decided to $ ^ 3 ^ {62} $ pressed into the state.

Will hit $ cnt <= 3 $, $ cnt = 4 $ $ 16 $-dimensional array Category talk for a year, but did not live sample.

In fact, this pressure into a shape memory search is a positive solution.

Because the legal status of the number is not much, you can search the memory directly.

A hash table to support queries of a state of operation, the definition states that:

Each of the different factors appeared many times (0/1/2),

Different factors refer to different $ $ n-factor, the quality factor set number.

Obviously we only need to maintain this information you can determine whether and up to no more than one number is not relatively prime.

 

 

 

C. Walker

In fact, only three variables found.

Therefore, n-$ $ $ pedestrian randomly selected from a $ 2, the solution vigorously trigonometric function of three variables.

Substituted into the initial position of $ n $ pedestrians, testing the legality of the correct number would be finished.

Guess you like

Origin www.cnblogs.com/skyh/p/11729130.html