70 exam simulation summary

T1 is quite water can be found to satisfy the equation listed divisible by the square of the factor n,

T2 is actually DP, really did not think messing around with the set on the test, then you have not seen Sample

Two consecutive planted in the DP, and pay attention to the accumulation of about ideas

 

T1 "trial division."

The complexity of launch 1e14 should be $ \ sqrt {N} $ complexity

Pythagorean theorem equation written slight simplification to give $ x + y = (y ^ 2 + N ^ 2) / N $

Therefore, $ N | y ^ 2 $ and $ y \ in [1, N-1] $ then x must satisfy the condition

 

T2 "DP" "pruning" "list."

The definition of f [i] represents the i-th position and taking into account the i-th bit is a cut-off point, the first not to consider the multi-dimensional simple definitions from start to try

f [i] = f [j] + cnt * cnt $ O (n ^ 2) $

It is clear that there is a pruning, f [i] is the initial i, j when descending enumerate this time cnt * cnt has> f [i], then do not run anymore

Positive solution is O (N \ sqrt {N}) of the linked list to maintain a forward jump from the next position

Guess you like

Origin www.cnblogs.com/casun547/p/11664736.html