Compare commits

..

3 Commits

Author SHA1 Message Date
fb8cf978a0 Stacking Cups 2023-07-16 23:01:00 +02:00
3dd1f0a732 Symmetric Order 2023-07-16 22:35:47 +02:00
eccd02fbbc Tai's formula 2023-07-16 22:20:32 +02:00
3 changed files with 53 additions and 0 deletions

16
cups.py Normal file
View File

@@ -0,0 +1,16 @@
n = int(input())
cups = {}
for _ in range(n):
tokens = input().split()
try:
value = int(tokens[0]) / 2
color = tokens[1]
except ValueError:
value = int(tokens[1])
color = tokens[0]
cups[color] = value
vals = sorted(cups.values())
for val in vals:
print(list(cups.keys())[list(cups.values()).index(val)])

18
symmetricorder.py Normal file
View File

@@ -0,0 +1,18 @@
n = int(input())
setnr = 1
while n:
names = []
for _ in range(n):
names.append(input())
names_even = [name for i, name in enumerate(names) if i % 2 == 0]
names_odd = [name for i, name in enumerate(names) if i % 2 == 1][::-1]
names = names_even + names_odd
print(f"SET {setnr}")
for name in names:
print(name)
n = int(input())
setnr += 1

19
taisformula.py Normal file
View File

@@ -0,0 +1,19 @@
n = int(input())
prev_t = 0
prev_v = 0
total = 0
for i in range(n):
m = input().split()
t = int(m[0])
v = float(m[1])
if prev_t == 0:
prev_t = t
prev_v = v
continue
total += ((prev_v + v) / 2) * (t - prev_t) / 1000
prev_t = t
prev_v = v
print(total)