LoginSignup
0
0

More than 1 year has passed since last update.

ABC150C Count Order

Posted at

覚えといたほうがいい知識

階乗

# N!を列挙する
from itertools import permutations
pairs = permutations([i+1 for i in range(3)])

配列表示の場合
print(list(pairs)) 
//-> [(1, 2, 3), (1, 3, 2), (2, 1, 3), (2, 3, 1), (3, 1, 2), (3, 2, 1)]
インデックスありの場合
for i,pair in enumerate(pairs):
    print(i,pair) // -> i,[1,2,3] .... 
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0