結果

問題 No.509 塗りつぶしツール
ユーザー 👑 obakyan
提出日時 2019-05-01 21:26:10
言語 Lua
(LuaJit 2.1.1734355927)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 269 bytes
コンパイル時間 301 ms
コンパイル使用メモリ 6,820 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-31 12:40:58
合計ジャッジ時間 1,177 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

local numstr = io.read()
local a, b, c = 0, 0, 0
for i = 1, #numstr do
  local s = numstr:sub(i, i)
  if(s == "0" or s == "4" or s == "6" or s == "9") then b = b + 1
  elseif(s == "8") then c = c + 1
  else a = a + 1 end
end
print(math.min(2*a+3*b+4*c+1, a+3*b+5*c+2))
0