結果
問題 | No.910 素数部分列 |
ユーザー |
|
提出日時 | 2024-09-09 01:10:56 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 59 ms / 1,000 ms |
コード長 | 632 bytes |
コンパイル時間 | 485 ms |
コンパイル使用メモリ | 82,024 KB |
実行使用メモリ | 71,528 KB |
最終ジャッジ日時 | 2024-09-09 01:11:02 |
合計ジャッジ時間 | 5,379 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 50 |
ソースコード
import syssys.setrecursionlimit(int(1e6))input = lambda: sys.stdin.readline().rstrip("\r\n")MOD = 998244353INF = int(4e18)if __name__ == "__main__":_ = int(input())s = input()nums = [int(v) for v in s]res = nums.count(3) + nums.count(5) + nums.count(7) # 3, 5, 7c1 = 0c9 = 0for s in nums:if s == 1:c1 += 1elif s == 9: # 19if c1:res += 1c1 -= 1else:c9 += 1while c9 >= 2 and c1: # 991res += 1c9 -= 2c1 -= 1res += c1 // 2 # 11print(res)