結果

問題 No.171 スワップ文字列(Med)
ユーザー tanimani364
提出日時 2021-03-22 22:01:13
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 56 ms / 1,000 ms
コード長 482 bytes
コンパイル時間 136 ms
コンパイル使用メモリ 82,500 KB
実行使用メモリ 64,512 KB
最終ジャッジ日時 2024-11-24 10:17:40
合計ジャッジ時間 1,386 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

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