Skip to content

Commit

Permalink
add examples
Browse files Browse the repository at this point in the history
  • Loading branch information
zehengl committed Aug 27, 2024
1 parent 523918c commit 4daac81
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/pakethanterare.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
t, b = [int(d) for d in input().split()]
s = [int(d) for d in input().split()]
p = {}
for _ in range(t):
k, v = input().split()
v = int(v)
p[k] = v
for n in s:
res = 0
for _ in range(n):
k, v = input().split()
v = int(v)
res += p[k] - v
print(res)
18 changes: 18 additions & 0 deletions src/taktsvedjur.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
n = int(input())
m = 1
s = 0
h = 0
while n:
a = int(input())
if a > 0:
h += 1
if h == 2 * m:
m = min(m * 2, 8)
h = 0
else:
m = m // 2 or 1
h = 0

s += m * a
n -= 1
print(s)

0 comments on commit 4daac81

Please sign in to comment.