Given a number n of [0,1e6], the need to construct a number m, so that M is a multiple of n, M belongs to [0,1e16] and M contains all the numbers [0,9]
If not present, output-1
Output-1 when n=0
When n belongs to [1,1e6]
M= (9876543210*1e5+n)-(9876543210*1e5+n)%n
Thus, the first 10 bits of this number will not change, so there is a guaranteed [0,9], minus the remainder of the modulo n so that it can be divisible, the number of bits exactly
When N=1e6 is using the above construction method the number of bits will be super, but only with the output 9876543210*1e5 on the line,,,
1#include <bits/stdc++.h>2 using namespacestd;3 Const Long Longmust=9876543210000000;4 intMain () {5 intT;6 Long LongN;7scanf"%d",&T); 8 while(t--){9scanf"%lld",&n);Ten if(!n) puts ("-1"); One Elseprintf"%lld\n", (Must+n)-(must+n)%n); A } - return 0; -}
View Code
[BZOJ2296] Random seed