結果

問題 No.171 スワップ文字列(Med)
コンテスト
ユーザー tanimani364
提出日時 2021-03-22 22:01:13
言語 PyPy3
(8.0.0 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 53 ms / 1,000 ms
+ 86µs
コード長 482 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 472 ms
コンパイル使用メモリ 65,144 KB
実行使用メモリ 60,716 KB
最終ジャッジ日時 2026-10-14 00:10:06
合計ジャッジ時間 2,204 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#!/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