結果
問題 |
No.910 素数部分列
|
ユーザー |
![]() |
提出日時 | 2020-06-14 00:36:06 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 564 bytes |
コンパイル時間 | 237 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 12,788 KB |
最終ジャッジ日時 | 2024-06-26 03:00:33 |
合計ジャッジ時間 | 8,782 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 33 WA * 17 |
ソースコード
# problem 1 N = int(input()) S = list(input()) ans = 0 dic = {"1": 0, "3": 0, "5": 0, "7": 0, "9": 0} for some in S: dic[some] += 1 ans = dic["3"]+dic["5"]+dic["7"] new = {1: 0, 9: 0} for x in S: n = int(x) if n == 1: new[1] += 1 if n == 9: new[9] += 1 if new[1] > 0: new[1] -= 1 new[9] -= 1 ans += 1 if new[9] >= new[1]**2: ans += new[1] print(ans) exit() elif new[9] < new[1]**2: p = new[9]//2 ans += p new[1] -= p*2 ans += new[1]//2 print(ans) exit()