Skip to content

Commit

Permalink
add examples
Browse files Browse the repository at this point in the history
  • Loading branch information
zehengl committed Jan 31, 2024
1 parent 7712d2a commit 9c7b66b
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/chugging.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
n, ta, da, tb, db = io.read("*n", "*n", "*n", "*n", "*n")
a = n * ta + da * (n - 1) * n / 2
b = n * tb + db * (n - 1) * n / 2
if a == b then
print("=")
elseif a < b then
print("Alice")
else
print("Bob")
end
10 changes: 10 additions & 0 deletions src/linesperhour.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
n, lph = [int(d) for d in input().split()]
loc = sorted([int(input()) for _ in range(n)])
s, l = 0, 0
for v in loc:
if l + v <= 5 * lph:
l += v
s += 1
else:
break
print(s)
2 changes: 2 additions & 0 deletions src/shandy.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
b, l = io.read("*n", "*n")
print(math.min(b, l) * 2)
10 changes: 10 additions & 0 deletions src/waterjournal.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
n, a, b = [int(d) for d in input().split()]
w = [int(input()) for _ in range(n - 1)]
if a in w and b in w:
print("\n".join([str(d) for d in range(a, b + 1)]))
elif a in w and b not in w:
print(b)
elif a not in w and b in w:
print(a)
else:
print(-1)
6 changes: 6 additions & 0 deletions src/wizardofodds.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
n, k = io.read("*n", "*n")
if math.log(n, 2) <= k then
print("Your wish is granted!")
else
print("You will become a flying monkey!")
end

0 comments on commit 9c7b66b

Please sign in to comment.