#P1028. 小 L 造数据
小 L 造数据
问题描述
小 L 想生成一个乱序的数组,于是,小 L 写了这样一个程序:
uint64_t x; //uint64_t represents 64-bit unsigned integer
int n;
uint64_t rand() { //this is a xor-shift random generator
x ^= x << 13;
x ^= x >> 7;
x ^= x << 17;
return x;
}
int main() {
cin >> n;
cin >> x;
for (int i = 1; i <= n; i++){ //random shuffle [1, 2,..., n]
a[i] = i;
swap(a[i], a[rand() % i + 1]);
}
for (int i = 1; i <= n; i++){ //print the result
cout << a[i] << (i == n ? '\n' : ' ');
}
}
过了几天后,小 L 发现自己只留下了当初程序输出的数组 ,以及数组长度 ,忘记了随机种子 是多少。
你能帮他算出当时的 吗?
可能存在多种可能的答案,输出任意一个即可。
输入格式
第一行一个正整数 。 第二行一个长为 的数组 。
输出格式
一行一个整数,表示 。
样例
50
36 22 24 21 27 50 28 14 25 34 18 43 47 13 30 7 10 48 20 16 29 9 8 15 3 31 12 38 19 49 37 1 46 32 4 44 11 35 6 33 26 5 45 17 39 40 2 23 42 41
16659580358178468547
数据范围
| 测试点编号 | ||
|---|---|---|