結果
問題 | No.171 スワップ文字列(Med) |
ユーザー |
![]() |
提出日時 | 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 |
ソースコード
#!/usr/bin/env python3#coding:utf-8import mathimport stringfrom sys import stdin# import numpy as np# from matplotlib import pyplot as pltdef main():read=stdin.readline#edit here!s=read()n=len(s)-1fact=[1]*(n+1)for i in range(n):fact[i+1]=fact[i]*(i+1)cnt=[0]*26base=ord('A')res=fact[n]for i in range(n):cnt[ord(s[i])-base]+=1for i in range(26):res//=fact[cnt[i]]res-=1res%=573print(res)if __name__ == '__main__':main()