Skip to content

Commit

Permalink
add examples
Browse files Browse the repository at this point in the history
  • Loading branch information
zehengl committed Dec 4, 2023
1 parent 374370f commit e09e258
Show file tree
Hide file tree
Showing 9 changed files with 103 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/climbingworm.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
a, b, h = io.read("*n", "*n", "*n")
t = 0
while h >= 0 do
h = h - a
t = t + 1
if h <= 0 then
break
end
h = h + b
end
print(t)
9 changes: 9 additions & 0 deletions src/climbingworm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
a, b, h = [int(d) for d in input().split()]
t = 0
while h >= 0:
h -= a
t += 1
if h <= 0:
break
h += b
print(t)
22 changes: 22 additions & 0 deletions src/kikiboba.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package main

import (
"fmt"
"strings"
)

func main() {
var w string
fmt.Scan(&w)
b := strings.Count(w, "b")
k := strings.Count(w, "k")
if b > k {
fmt.Println("boba")
} else if b < k {
fmt.Println("kiki")
} else if b > 0 {
fmt.Println("boki")
} else {
fmt.Println("none")
}
}
10 changes: 10 additions & 0 deletions src/kikiboba.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
w = input()
b, k = w.count("b"), w.count("k")
if not b and not k:
print("none")
elif b == k:
print("boki")
elif b > k:
print("boba")
else:
print("kiki")
15 changes: 15 additions & 0 deletions src/maeting.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from collections import Counter

d = Counter()
for _ in range(int(input())):
d[input()] = 0

for _ in range(int(input())):
l = input().split()
if len(l) == 1:
continue
for n in l[1:]:
d[n] += 1

for k in sorted(d, key=lambda k: -d[k]):
print(d[k], k)
10 changes: 10 additions & 0 deletions src/skotleikur.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
k = int(input())
a = int(input())
b = int(input())
ans = []
for i in range(0, k // a + 1):
if (k - a * i) % b == 0:
ans.append((i, (k - a * i) // b))
print(len(ans))
for i, j in ans:
print(i, j)
13 changes: 13 additions & 0 deletions src/stadiljus.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
n = int(input())
x = int(input())
y = int(input())
l = sorted([int(d) for d in input().split()])

total, c = 0, 0
for d in l:
if (total + d * x) / (c + 1) <= y:
total += d * x
c += 1
else:
break
print(c)
7 changes: 7 additions & 0 deletions src/trollhunt.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
b, k, g = io.read("*n", "*n", "*n")
b = b - 1
d = b // (k // g)
if b % (k // g) > 0 then
d = d + 1
end
print(d)
6 changes: 6 additions & 0 deletions src/trollhunt.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
b, k, g = [int(d) for d in input().split()]
b -= 1
d = b // (k // g)
if b % (k // g):
d += 1
print(d)

0 comments on commit e09e258

Please sign in to comment.