結果
| 問題 |
No.910 素数部分列
|
| コンテスト | |
| ユーザー |
alexara1123
|
| 提出日時 | 2019-10-18 22:46:38 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 891 bytes |
| コンパイル時間 | 195 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 11,392 KB |
| 最終ジャッジ日時 | 2024-06-25 17:55:14 |
| 合計ジャッジ時間 | 3,569 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | RE * 3 |
| other | RE * 50 |
ソースコード
from fractions import gcd
from datetime import date, timedelta
from heapq import*
import math
from collections import defaultdict, Counter, deque
import sys
from bisect import *
import itertools
import copy
sys.setrecursionlimit(10 ** 7)
MOD = 10 ** 9 + 7
def main():
n = int(input())
s = list(input())
s2 = []
ans = 0
for i in range(n):
if s[i] == "3" or s[i] == "5" or s[i] == "7":
ans += 1
else:
s2.append(s[i])
one, nine = 0, 0
for i in range(len(s2)):
if s2[i] == "1":
one+=1
elif s2[i] == "9":
if one > 0:
ans += 1
one -= 1
else:
nine += 1
ans += (one // 2)
one %=2
if one == 1 and nine > 1:
ans+=1
print(ans)
if __name__ == '__main__':
main()
alexara1123