Description
(Jzoj 3298)
There's a necklace of n-N beads
Each bead has 3 sides, can write 3 numbers, the range of numbers (0,a] (0,a], the two beads are the same when and only if they can be turned into the same
The three-digit greatest common divisor on each bead must be equal to 1
Two adjacent beads must be different
If two necklaces can be turned into the same, we think the two strings are the same.
Given n N and a A, how many different necklaces are asked. Answer to 1000000007 1000000007 modulo. Data Constraint
For data of 10 10%: n<=10,a<=10,t<=10 N;
For data of 20 20%: n<=1000,a<=100,t<=10 N;
For data of 40 40%: n<=109,a<=100,t<=10 N;
For data of 60 60%: n<=106,a<=105,t<=10 N;
For data of 80 80%: n<=109,a<=105,t<=10 N;
For data of 100 100%: n<=1014,a<=107,t<=10 N; solution
Ask for Bead type first
Useful only in order to
123 122 112 111
Numbers represent size relationships
111 There is only one
122 112 figure out 12 and.
123 count.
12:
Set F[i][a]