Skip to content

Commit

Permalink
add examples
Browse files Browse the repository at this point in the history
  • Loading branch information
zehengl committed Nov 19, 2024
1 parent 698219d commit 7d533d7
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/herbmixing.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
g, r = io.read("*n", "*n")
ans = 0
if g > 0 then
ans = ans + 10 * math.min(g, r)
remain = math.max(g - r, 0)
ans = ans + 10 * (remain // 3)
remain = remain % 3
ans = ans + 3 * (remain // 2)
remain = remain % 2
ans = ans + remain
end
print(ans)
11 changes: 11 additions & 0 deletions src/herbmixing.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
g, r = [int(d) for d in input().split()]
ans = 0
if g > 0:
ans += 10 * min(g, r)
remain = max(g - r, 0)
ans += 10 * (remain // 3)
remain %= 3
ans += 3 * (remain // 2)
remain %= 2
ans += remain
print(ans)

0 comments on commit 7d533d7

Please sign in to comment.