結果

問題 No.2593 Reorder and Mod 120
ユーザー ntuda
提出日時 2023-12-23 11:56:01
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 402 bytes
コンパイル時間 218 ms
コンパイル使用メモリ 82,112 KB
実行使用メモリ 76,728 KB
最終ジャッジ日時 2024-09-27 12:20:39
合計ジャッジ時間 2,696 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 21 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
from itertools import permutations

dic = defaultdict(int)
N = int(input())
S = input()
sum0 = 0
for s in S:
    s = int(s)
    dic[s] += 1
    sum0 += s
X = []
for k, v in dic.items():
    X += [k] * (min(3, v))

Y = set()
for a, b, c in set(permutations(X, 3)):
    y = a * 100 + b * 10 + c + 40 * ((sum0 - a - b - c) % 3)
    y %= 120
    Y.add(y)

print(len(Y))
0