about summary refs log tree commit diff
path: root/codechef/brkbks.lua
diff options
context:
space:
mode:
authorNguyễn Gia Phong <vn.mcsinyx@gmail.com>2020-01-13 16:29:31 +0700
committerNguyễn Gia Phong <vn.mcsinyx@gmail.com>2020-01-13 16:29:31 +0700
commit65b8ebda4c47fa27ac28899fb2b29097f445b6df (patch)
treee43589f1f02ab11946006b70fe79c79d82629f11 /codechef/brkbks.lua
parent0887d8f96950a060a122e14ed2981182ff1eb37d (diff)
downloadcp-65b8ebda4c47fa27ac28899fb2b29097f445b6df.tar.gz
I'm so burnt out rn
Diffstat (limited to 'codechef/brkbks.lua')
-rwxr-xr-xcodechef/brkbks.lua14
1 files changed, 14 insertions, 0 deletions
diff --git a/codechef/brkbks.lua b/codechef/brkbks.lua
new file mode 100755
index 0000000..88dc15b
--- /dev/null
+++ b/codechef/brkbks.lua
@@ -0,0 +1,14 @@
+#!/usr/bin/env lua
+local read = io.read
+local print = print
+
+for t = 1, read('*n') do
+    local s, w1, w2, w3 = read('*n', '*n', '*n', '*n')
+    if w1 + w2 + w3 <= s then
+        print(1)
+    elseif w1 + w2 <= s or w2 + w3 <= s then
+        print(2)
+    else
+        print(3)
+    end
+end