結果
| 問題 | No.2593 Reorder and Mod 120 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2023-12-29 15:42:38 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 74 ms / 2,000 ms | 
| コード長 | 357 bytes | 
| コンパイル時間 | 162 ms | 
| コンパイル使用メモリ | 82,368 KB | 
| 実行使用メモリ | 76,968 KB | 
| 最終ジャッジ日時 | 2024-09-27 16:13:10 | 
| 合計ジャッジ時間 | 2,673 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 26 | 
ソースコード
from collections import Counter, defaultdict
N = int(input())
S = input()
ans = set()
C_S = Counter(S)
for i in range(1000):
    isOK = True
    d = defaultdict(int)
    for t in list(str(i).zfill(min(3, N))):
        d[t] += 1
    for k, v in d.items():
        if C_S[k] < v:
            isOK = False
    if isOK:
        ans.add(i % 40)
print(len(ans))
            
            
            
        