結果

問題 No.171 スワップ文字列(Med)
ユーザー tanimani364tanimani364
提出日時 2021-03-22 22:01:13
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 148 ms / 1,000 ms
コード長 482 bytes
コンパイル時間 475 ms
コンパイル使用メモリ 87,092 KB
実行使用メモリ 80,460 KB
最終ジャッジ日時 2023-08-16 01:02:42
合計ジャッジ時間 3,271 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 145 ms
80,312 KB
testcase_01 AC 145 ms
80,268 KB
testcase_02 AC 148 ms
80,288 KB
testcase_03 AC 144 ms
80,140 KB
testcase_04 AC 144 ms
80,436 KB
testcase_05 AC 145 ms
80,040 KB
testcase_06 AC 145 ms
80,400 KB
testcase_07 AC 145 ms
80,460 KB
testcase_08 AC 145 ms
80,252 KB
testcase_09 AC 146 ms
80,176 KB
testcase_10 AC 139 ms
80,280 KB
testcase_11 AC 144 ms
80,136 KB
testcase_12 AC 142 ms
80,140 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
#coding:utf-8

import math
import string
from sys import stdin
# import numpy as np
# from matplotlib import pyplot as plt



def main():
	read=stdin.readline

	#edit here!
	s=read()
	n=len(s)-1
	
	fact=[1]*(n+1)
	for i in range(n):
		fact[i+1]=fact[i]*(i+1)

	cnt=[0]*26
	
	base=ord('A')
	res=fact[n]

	for i in range(n):
		cnt[ord(s[i])-base]+=1
	
	for i in range(26):
		res//=fact[cnt[i]]

	res-=1
	res%=573
	print(res)

if __name__ == '__main__':
	main()
0