文件名称:sjqpl
介绍说明--下载内容均来自于网络,请自行研究使用
编制生成0~n(n≤255)的一个全排列的程序,可选择下列两个方法之一或自行设计另外方法:
方法1:从一个随机文件读取n+1字节数据d0, d1, L, dn。由预先取定的一个0~n的全排列P(比如,可为0~n的自然排列)开始,依次对i=n, n-1, L, 1,计算:j=di-1+di (mod i)交换P的第i项第j项(在此注意我们假定P从第0项开始)。
方法2:用一个随机函数产生m(m>n)字节数据d1, d2, L, dm。对d1(mod (n+1)), d2(mod (n+1)), L, dm(mod (n+1))依次考察,把后面出现的与前相同者去掉;在最后剩下的数据中,把没有出现的0~n依序补写于后面。
-Establishment generates 0 ~ n (n≤255) a full array of programs, you can choose one or another method to design the following two methods: Method 1: Read n+1 byte data d0, d1, L a random file, dn. The prefetched given a 0 ~ n' s full permutation P (for example, can be 0 ~ n the natural order) starts sequentially for i = n, n-1, L, 1, calculated: j = di-1+di (mod i) the exchange of P i Item item j (In this note we assume P starts 0). Method 2: with a random function to generate m (m> n) bytes of data d1, d2, L, dm. On d1 (mod (n+1)), d2 (mod (n+1)), L, dm (mod (n+1)) followed by visits to the same person behind the emerging removed before the last remaining data in the no The 0 ~ n sequentially written up in the back.
方法1:从一个随机文件读取n+1字节数据d0, d1, L, dn。由预先取定的一个0~n的全排列P(比如,可为0~n的自然排列)开始,依次对i=n, n-1, L, 1,计算:j=di-1+di (mod i)交换P的第i项第j项(在此注意我们假定P从第0项开始)。
方法2:用一个随机函数产生m(m>n)字节数据d1, d2, L, dm。对d1(mod (n+1)), d2(mod (n+1)), L, dm(mod (n+1))依次考察,把后面出现的与前相同者去掉;在最后剩下的数据中,把没有出现的0~n依序补写于后面。
-Establishment generates 0 ~ n (n≤255) a full array of programs, you can choose one or another method to design the following two methods: Method 1: Read n+1 byte data d0, d1, L a random file, dn. The prefetched given a 0 ~ n' s full permutation P (for example, can be 0 ~ n the natural order) starts sequentially for i = n, n-1, L, 1, calculated: j = di-1+di (mod i) the exchange of P i Item item j (In this note we assume P starts 0). Method 2: with a random function to generate m (m> n) bytes of data d1, d2, L, dm. On d1 (mod (n+1)), d2 (mod (n+1)), L, dm (mod (n+1)) followed by visits to the same person behind the emerging removed before the last remaining data in the no The 0 ~ n sequentially written up in the back.
(系统自动生成,下载前可以参看下载内容)
下载文件列表
随机全排列.cpp