Rosalind第29题:Enumerating Oriented Gene Orderings

Problem

signed permutation of length  is some ordering of the positive integers  in which each integer is then provided with either a positive or negative sign (for the sake of simplicity, we omit the positive sign). For example,  is a signed permutation of length .

Given: A positive integer .

Return: The total number of signed permutations of length , followed by a list of all such permutations (you may list the signed permutations in any order).

长度的有符号排列 是正整数的一些排序  然后为每个整数提供一个正号或负号(为简单起见,我们省略了正号)。例如, 是长度的有符号排列 。

给定:正整数。

返回:长度的有符号排列总数,然后是所有此类排列的列表(您可以按任何顺序列出带符号的排列)。

Sample Dataset

2

Sample Output

8
-1 -2
-1 2
1 -2
1 2
-2 -1
-2 1
2 -1
2 1
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值