結果

問題 No.2593 Reorder and Mod 120
ユーザー PNJPNJ
提出日時 2024-04-25 12:00:33
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 479 bytes
コンパイル時間 349 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 71,040 KB
最終ジャッジ日時 2024-04-25 12:00:37
合計ジャッジ時間 2,879 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 46 ms
61,696 KB
testcase_01 AC 36 ms
52,224 KB
testcase_02 AC 46 ms
62,080 KB
testcase_03 AC 48 ms
61,824 KB
testcase_04 AC 55 ms
61,952 KB
testcase_05 AC 53 ms
61,568 KB
testcase_06 AC 48 ms
61,952 KB
testcase_07 AC 39 ms
51,712 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 43 ms
51,840 KB
testcase_11 AC 54 ms
63,616 KB
testcase_12 AC 59 ms
64,256 KB
testcase_13 AC 57 ms
70,400 KB
testcase_14 AC 54 ms
66,048 KB
testcase_15 AC 58 ms
68,992 KB
testcase_16 AC 52 ms
64,256 KB
testcase_17 AC 54 ms
65,792 KB
testcase_18 AC 54 ms
65,408 KB
testcase_19 AC 61 ms
70,144 KB
testcase_20 AC 57 ms
70,656 KB
testcase_21 AC 58 ms
70,656 KB
testcase_22 AC 59 ms
70,784 KB
testcase_23 AC 58 ms
71,040 KB
testcase_24 AC 56 ms
70,144 KB
testcase_25 AC 59 ms
70,272 KB
testcase_26 AC 60 ms
70,016 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# 120 = 3*5*8
# 下3桁だけで、40で割った余りは決定する。
# 3で割った余りは固定。
# CRT

N = int(input())
S = input()
if N == 2:
  T = S[::-1]
  ans = 2
  if int(S) % 120 == int(T) % 120:
    ans = 1
  print(ans)
  exit()

C = [0 for i in range(10)]
for i in range(N):
  C[int(S[i])] += 1
X = set()
for i in range(100,1000):
  n = str(i)
  CC = C[:]
  for j in range(len(n)):
    CC[int(n[j])] -= 1
  if min(CC) >= 0:
    X.add(i % 40)
print(len(X))
0