結果
| 問題 | No.91 赤、緑、青の石 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-04-14 20:23:51 |
| 言語 | Lua (LuaJit 2.1.1734355927) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 598 bytes |
| 記録 | |
| コンパイル時間 | 310 ms |
| コンパイル使用メモリ | 7,848 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2025-12-07 12:33:30 |
| 合計ジャッジ時間 | 1,202 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 29 |
ソースコード
t = {}
t[1], t[2], t[3] = io.read("*n", "*n", "*n")
table.sort(t)
cnt, a, b = t[1], t[2] - t[1], t[3] - t[1]
plan13 = math.floor((b - a) / 2)
plan13 = math.min(plan13, math.floor(b / 3))
plan13 = math.min(plan13, a)
cnt = cnt + plan13
a = a - plan13
b = b - plan13 * 3
plan44 = math.floor(a / 4)
plan44 = math.min(plan44, b / 4)
cnt = cnt + plan44 * 2
a = a - plan44 * 4
b = b - plan44 * 4
cand = 0
if(a == 3) then
cand = 1 + math.floor((b - 1) / 5)
end
plan13 = math.min(a, math.floor(b / 3))
plan05 = math.floor((b - plan13 * 3) / 5)
cnt = cnt + math.max(cand, plan13 + plan05)
print(cnt)