示例#1
0
文件: sign.go 项目: ssobczak/rosalind
func sign(n int) {
	fmt.Println(factorial(n) * (1 << uint8(n)))

	a := make([]int, n)
	for k := range a {
		a[k] = k + 1
	}

	signPerm(a)
	for permutable.NextPermutation(permutable.PermInts(a)) {
		signPerm(a)
	}
}
示例#2
0
文件: perm.go 项目: ssobczak/rosalind
func Perm() {
	n := 0

	if _, err := fmt.Scanf("%d", &n); err != nil {
		log.Fatal(err)
	}

	fmt.Println(factorial(n))

	a := make([]int, n)
	for k := range a {
		a[k] = k + 1
	}

	printPerm(a)
	for permutable.NextPermutation(permutable.PermInts(a)) {
		printPerm(a)
	}
}