結果

問題 No.2593 Reorder and Mod 120
ユーザー 三浦理稀三浦理稀
提出日時 2024-01-19 09:38:04
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 684 bytes
コンパイル時間 252 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 13,416 KB
最終ジャッジ日時 2024-01-19 09:38:08
合計ジャッジ時間 3,751 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
9,984 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 30 ms
9,984 KB
testcase_09 AC 37 ms
9,984 KB
testcase_10 AC 31 ms
9,984 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 137 ms
13,416 KB
testcase_25 AC 133 ms
13,416 KB
testcase_26 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
s = list(map(int, list(input())))
from collections import defaultdict as dd
d = dd(int)
for e in s:
	d[e] += 1
sums = sum(s)

exp = [1]
for i in range(n):
	exp.append((exp[-1]*10)%120)

ans = set()
for i in range(1,10):
	for j in range(1,10):
		for k in range(1,10):
			if i == j == k and d[i] >= 3:
				ans.add(111*i + 40*(sums - (i+j+k)))
			elif i==j and d[j] >= 2 and d[k]:
				ans.add(111*i + 40*(sums - (i+j+k)))
			elif i == k and d[i] >= 2 and d[j]:
				ans.add(111*i + 40*(sums - (i+j+k)))
			elif j == k and d[j] >= 2 and d[i]:
				ans.add(111*i + 40*(sums - (i+j+k)))
			elif d[i] and d[j] and d[k]:
				ans.add(111*i + 40*(sums - (i+j+k)))
print(len(ans))
0