为节省程序输入耗时,序列 将在你的程序内部由 xorShift128Plus 和提供的种子生成。下面给出 C++ 语言下的示例程序:
#include<cstdio>// scanfconstint MAXN =712;// Set a right value according to your solution.
int n, a[MAXN +1];namespaceGenerator{unsignedlonglong k1, k2;int thres;inlineunsignedlonglongxorShift128Plus(){unsignedlonglong k3 = k1, k4 = k2;
k1 = k4, k3 ^=(k3 <<23), k2 = k3 ^ k4 ^(k3 >>17)^(k4 >>26);return k2 + k4;}inlinevoidgenerate(){for(int i =1; i <= n;++i){
a[i]=xorShift128Plus()% thres;}}}// namespace Generator.
intmain(){scanf("%d",&n);scanf("%llu%llu%d",&Generator::k1,&Generator::k2,&Generator::thres);Generator::generate();// Now array a[1..n] represents the sequence A in the statement.
return0;}