初自力再帰AC 1時間半の葛藤 atcoder.jp/contests/abc15…
@python31369078 再帰でかけるの素晴らしいです itertools.permutations()が使えると便利ですよ!