結果
問題 |
No.910 素数部分列
|
ユーザー |
👑 |
提出日時 | 2020-03-27 20:38:57 |
言語 | Lua (LuaJit 2.1.1734355927) |
結果 |
WA
|
実行時間 | - |
コード長 | 544 bytes |
コンパイル時間 | 96 ms |
コンパイル使用メモリ | 6,820 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2025-01-02 09:20:55 |
合計ジャッジ時間 | 1,607 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 13 WA * 37 |
ソースコード
local n = io.read("*n", "*l") local s = io.read() local ret = 0 local cur9 = 0 local cur1 = 0 for i = 1, n do local ss = s:sub(i, i):byte() - 48 if ss == 1 then if 2 <= cur9 then -- 991 cur9 = cur9 - 2 ret = ret + 1 elseif 1 <= cur1 then -- 11 cur1 = cur1 - 1 ret = ret + 1 else cur1 = cur1 + 1 end elseif ss == 9 then if 1 <= cur1 then -- 19 cur1 = cur1 - 1 ret = ret + 1 else cur9 = cur9 + 1 end else ret = ret + 1 end end print(ret)