結果

問題 No.170 スワップ文字列(Easy)
ユーザー tabataba
提出日時 2016-04-16 22:24:55
言語 Python2
(2.7.18)
結果
AC  
実行時間 389 ms / 5,000 ms
コード長 267 bytes
コンパイル時間 362 ms
コンパイル使用メモリ 7,132 KB
実行使用メモリ 11,748 KB
最終ジャッジ日時 2023-08-24 16:28:57
合計ジャッジ時間 2,905 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 12 ms
6,044 KB
testcase_01 AC 389 ms
11,732 KB
testcase_02 AC 11 ms
6,124 KB
testcase_03 AC 12 ms
6,040 KB
testcase_04 AC 16 ms
6,016 KB
testcase_05 AC 377 ms
11,724 KB
testcase_06 AC 384 ms
11,748 KB
testcase_07 AC 11 ms
6,036 KB
testcase_08 AC 13 ms
6,076 KB
testcase_09 AC 14 ms
6,008 KB
testcase_10 AC 205 ms
8,248 KB
testcase_11 AC 12 ms
6,132 KB
testcase_12 AC 11 ms
5,912 KB
testcase_13 AC 12 ms
6,008 KB
testcase_14 AC 12 ms
6,008 KB
testcase_15 AC 14 ms
6,008 KB
testcase_16 AC 12 ms
6,068 KB
testcase_17 AC 12 ms
6,064 KB
testcase_18 AC 11 ms
5,916 KB
testcase_19 AC 11 ms
5,916 KB
testcase_20 AC 12 ms
6,064 KB
testcase_21 AC 12 ms
6,012 KB
testcase_22 AC 12 ms
5,924 KB
testcase_23 AC 11 ms
6,064 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
s=raw_input()
l=len(s)
m=set([s])
n=-1
for _ in xrange(math.factorial(l)):
	if n==len(m):
		break
	n=len(m)
	for i in m.copy():
		i=list(i)
		for j in range(len(s)-1):
			i[j],i[j+1]=i[j+1],i[j]
			m.add("".join(i))
		#print len(m)
#print m
print len(m)-1
0