結果
問題 |
No.910 素数部分列
|
ユーザー |
👑 |
提出日時 | 2020-03-27 20:41:46 |
言語 | Lua (LuaJit 2.1.1734355927) |
結果 |
WA
|
実行時間 | - |
コード長 | 497 bytes |
コンパイル時間 | 123 ms |
コンパイル使用メモリ | 6,820 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2025-01-02 09:22:05 |
合計ジャッジ時間 | 1,919 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 28 WA * 22 |
ソースコード
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 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 ret = ret + math.floor(cur1 / 2) print(ret)