about summary refs log tree commit diff
path: root/codechef/brkbks.lua
diff options
context:
space:
mode:
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