Compare commits
85 Commits
5b739eda96
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 020015474f | |||
| 799f2283c7 | |||
| b58f0998db | |||
| ae55249b47 | |||
| 38610bdd11 | |||
| de8643b5f2 | |||
| 786cf4dc88 | |||
| a3320343ef | |||
| a309dad256 | |||
| f5925dedeb | |||
| 2ebdbbc5b5 | |||
| 986dc102d7 | |||
| 26347645b6 | |||
| 49a86bff16 | |||
| d661b76d6c | |||
| 1fa5411107 | |||
| 08da2c1c73 | |||
| 97bbb9503b | |||
| 03302ded7c | |||
| 6e1ab93478 | |||
| 0dc3d6f827 | |||
| 6fa60c5f30 | |||
| bdefb17596 | |||
| b21298e68c | |||
| 8343b44c8d | |||
| 7977d3e82c | |||
| 9d1e862202 | |||
| c5728fa19e | |||
| 61b575d34f | |||
| 30941abe2d | |||
| 3963a3498a | |||
| adb3cc79d4 | |||
| 09cc6efe46 | |||
| 52ed4d25f8 | |||
| 7f4f85f804 | |||
| 7b7c85d278 | |||
| 9be61644a4 | |||
| 4481e9cc18 | |||
| 022eaf7a60 | |||
| 220d30556d | |||
| 947a85d630 | |||
| 17d266942c | |||
| 8a8cfa5c43 | |||
| db736b30b3 | |||
| 0d0ebece77 | |||
| ef9eb28323 | |||
| 7bbb5bcb4f | |||
| 4cd0be10d4 | |||
| 271421a989 | |||
| 18e5789449 | |||
| 824bc3ee7c | |||
| d5eca55da3 | |||
| ff54ec63ec | |||
| 6d748103e0 | |||
| 50b147dec7 | |||
| fb8cf978a0 | |||
| 3dd1f0a732 | |||
| eccd02fbbc | |||
| 4bc8d64e38 | |||
| 910504b0d7 | |||
| 95979cdcf0 | |||
| 11de2df636 | |||
| 1c2396075e | |||
| 1182218885 | |||
| 2d740cf8d3 | |||
| 95aa076e8f | |||
| 9ee48aa678 | |||
| 4a4158fa23 | |||
| 85b9ad927d | |||
| 51e42c20bb | |||
| e6d2456808 | |||
| 14a73c3463 | |||
| 8eeea7ade2 | |||
| 34a5590ed1 | |||
| 38c3a864ef | |||
| 369ecff5e3 | |||
| fed7a05832 | |||
| 09861a2f4f | |||
| abea187f67 | |||
| df0345596a | |||
| 9471cd2034 | |||
| fee7f6a8e1 | |||
| 7973279c5e | |||
| 575278be6e | |||
| 793a47e1c2 |
30
1dfroggereasy.py
Normal file
30
1dfroggereasy.py
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
n, s, m = map(int, input().split())
|
||||||
|
s -= 1
|
||||||
|
board = list(map(int, input().split()))
|
||||||
|
shadow_board = [0] * n
|
||||||
|
|
||||||
|
|
||||||
|
def print_ending(ending, hops):
|
||||||
|
print(ending)
|
||||||
|
print(hops)
|
||||||
|
exit()
|
||||||
|
|
||||||
|
|
||||||
|
hops = 0
|
||||||
|
while True:
|
||||||
|
if shadow_board[s] == 1:
|
||||||
|
print_ending("cycle", hops)
|
||||||
|
|
||||||
|
shadow_board[s] = 1
|
||||||
|
|
||||||
|
if board[s] == m:
|
||||||
|
print_ending("magic", hops)
|
||||||
|
|
||||||
|
if s + board[s] < 0:
|
||||||
|
print_ending("left", hops + 1)
|
||||||
|
|
||||||
|
if n <= s + board[s]:
|
||||||
|
print_ending("right", hops + 1)
|
||||||
|
|
||||||
|
s += board[s]
|
||||||
|
hops += 1
|
||||||
4
aleidibio.py
Normal file
4
aleidibio.py
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
a = int(input())
|
||||||
|
b = int(input())
|
||||||
|
c = int(input())
|
||||||
|
print(c - a - b)
|
||||||
2
ameriskur.py
Normal file
2
ameriskur.py
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
length = float(input())
|
||||||
|
print(length * 0.09144)
|
||||||
21
arithmeticfunctions.cpp
Normal file
21
arithmeticfunctions.cpp
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
#include "arithmeticfunctions.h"
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
|
// Compute x^3
|
||||||
|
int cube(int x){
|
||||||
|
return pow(x, 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Compute the maximum of x and y
|
||||||
|
int max(int x, int y){
|
||||||
|
if (x>y) {
|
||||||
|
return x;
|
||||||
|
} else {
|
||||||
|
return y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Compute x - y
|
||||||
|
int difference(int x, int y){
|
||||||
|
return x - y;
|
||||||
|
}
|
||||||
20
arithmeticfunctions.h
Normal file
20
arithmeticfunctions.h
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
int cube(int x);
|
||||||
|
int max(int x, int y);
|
||||||
|
int difference(int x, int y);
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
int cube2 = cube(2);
|
||||||
|
if (cube2 != 8) {
|
||||||
|
std::cout << "ERROR: cube(2) = " << cube2 << ", expected 8" << std::endl;
|
||||||
|
}
|
||||||
|
int max85 = max(8, 5);
|
||||||
|
if (max85 != 8) {
|
||||||
|
std::cout << "ERROR: max(8, 5) = " << max85 << ", expected 8" << std::endl;
|
||||||
|
}
|
||||||
|
int diff102 = difference(10, 2);
|
||||||
|
if (diff102 != 8) {
|
||||||
|
std::cout << "ERROR: difference(10, 2) = " << diff102 << ", expected 8" << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
3
astackofgold.py
Normal file
3
astackofgold.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
w, s = map(int, input().split())
|
||||||
|
c = s * (s + 1) / 2
|
||||||
|
print(int((w - (c * 29260)) / 110))
|
||||||
9
barcelona.py
Normal file
9
barcelona.py
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
n, k = map(int, input().split())
|
||||||
|
pos = list(map(int, input().split()))
|
||||||
|
|
||||||
|
if pos[0] == k:
|
||||||
|
print("fyrst")
|
||||||
|
elif pos[1] == k:
|
||||||
|
print("naestfyrst")
|
||||||
|
else:
|
||||||
|
print(f"{pos.index(k)+1} fyrst")
|
||||||
19
basketballoneonone.py
Normal file
19
basketballoneonone.py
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
def end_game(winner):
|
||||||
|
print(winner)
|
||||||
|
exit()
|
||||||
|
|
||||||
|
|
||||||
|
game_records = input()
|
||||||
|
a_score = 0
|
||||||
|
b_score = 0
|
||||||
|
|
||||||
|
for i in range(0, len(game_records), 2):
|
||||||
|
if game_records[i] == "A":
|
||||||
|
a_score += int(game_records[i + 1])
|
||||||
|
else:
|
||||||
|
b_score += int(game_records[i + 1])
|
||||||
|
|
||||||
|
if a_score >= 11 and (b_score < 10 or a_score - b_score >= 2):
|
||||||
|
end_game("A")
|
||||||
|
if b_score >= 11 and (a_score < 10 or b_score - a_score >= 2):
|
||||||
|
end_game("B")
|
||||||
1
bergmal.py
Normal file
1
bergmal.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
print(input())
|
||||||
36
bluetooth.py
Normal file
36
bluetooth.py
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
n = int(input())
|
||||||
|
|
||||||
|
uleft = set(range(1, 9))
|
||||||
|
uright = set(range(1, 9))
|
||||||
|
lleft = set(range(1, 9))
|
||||||
|
lright = set(range(1, 9))
|
||||||
|
|
||||||
|
for _ in range(n):
|
||||||
|
dental_problem = input().split()
|
||||||
|
|
||||||
|
try:
|
||||||
|
if dental_problem[1] == "m":
|
||||||
|
if dental_problem[0][0] == "-":
|
||||||
|
lleft.remove(int(dental_problem[0][1]))
|
||||||
|
elif dental_problem[0][0] == "+":
|
||||||
|
uleft.remove(int(dental_problem[0][1]))
|
||||||
|
elif dental_problem[0][1] == "-":
|
||||||
|
lright.remove(int(dental_problem[0][0]))
|
||||||
|
elif dental_problem[0][1] == "+":
|
||||||
|
uright.remove(int(dental_problem[0][0]))
|
||||||
|
else:
|
||||||
|
if dental_problem[0][0] == "+" or dental_problem[0][0] == "-":
|
||||||
|
lleft = set()
|
||||||
|
uleft = set()
|
||||||
|
else:
|
||||||
|
lright = set()
|
||||||
|
uright = set()
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
if len(lleft) > 0 and len(uleft) > 0:
|
||||||
|
print(0)
|
||||||
|
elif len(lright) > 0 and len(uright) > 0:
|
||||||
|
print(1)
|
||||||
|
else:
|
||||||
|
print(2)
|
||||||
1
canadianseh.py
Normal file
1
canadianseh.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
print("Canadian!" if input()[-3:] == "eh?" else "Imposter!")
|
||||||
5
codetosavelives.py
Normal file
5
codetosavelives.py
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
n = int(input())
|
||||||
|
for _ in range(n):
|
||||||
|
a = int(input().replace(" ", ""))
|
||||||
|
b = int(input().replace(" ", ""))
|
||||||
|
print(" ".join(str(a + b)))
|
||||||
21
conformity.py
Normal file
21
conformity.py
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
n = int(input())
|
||||||
|
|
||||||
|
combinations = {}
|
||||||
|
maxcombi = 0
|
||||||
|
combinations[maxcombi] = 0
|
||||||
|
|
||||||
|
for _ in range(n):
|
||||||
|
combi = "".join(sorted(input().strip().split()))
|
||||||
|
if combi in combinations.keys():
|
||||||
|
combinations[combi] += 1
|
||||||
|
if combinations[maxcombi] < combinations[combi]:
|
||||||
|
maxcombi = combi
|
||||||
|
else:
|
||||||
|
combinations[combi] = 1
|
||||||
|
|
||||||
|
max_value = combinations[maxcombi]
|
||||||
|
most_popular = sum(
|
||||||
|
[max_value for key in combinations if combinations[key] == max_value]
|
||||||
|
)
|
||||||
|
|
||||||
|
print(most_popular if most_popular > 0 else len(combinations.keys()) - 1)
|
||||||
16
cups.py
Normal file
16
cups.py
Normal 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)])
|
||||||
9
datum.py
Normal file
9
datum.py
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
from datetime import datetime
|
||||||
|
|
||||||
|
d, m = map(int, input().split())
|
||||||
|
date = datetime(year=2009, month=m, day=d)
|
||||||
|
print(
|
||||||
|
["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"][
|
||||||
|
date.weekday()
|
||||||
|
]
|
||||||
|
)
|
||||||
7
deathknight.py
Normal file
7
deathknight.py
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
n = int(input())
|
||||||
|
wins = 0
|
||||||
|
for _ in range(n):
|
||||||
|
k = input()
|
||||||
|
if "CD" not in k:
|
||||||
|
wins += 1
|
||||||
|
print(wins)
|
||||||
11
dfyrirdreki.py
Normal file
11
dfyrirdreki.py
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
a = int(input())
|
||||||
|
b = int(input())
|
||||||
|
c = int(input())
|
||||||
|
|
||||||
|
d = b**2 - 4 * a * c
|
||||||
|
if d > 0:
|
||||||
|
print(2)
|
||||||
|
elif d < 0:
|
||||||
|
print(0)
|
||||||
|
else:
|
||||||
|
print(1)
|
||||||
1
dragafra.py
Normal file
1
dragafra.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
print(int(input()) - int(input()))
|
||||||
23
drmmessages.py
Normal file
23
drmmessages.py
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
def sumOfValuesOfCharacters(s: str) -> int:
|
||||||
|
return sum([ord(c) - 65 for c in s])
|
||||||
|
|
||||||
|
|
||||||
|
def rotateString(s: str, r: int) -> str:
|
||||||
|
return "".join([chr(((ord(c) - 65 + r) % 26) + 65) for c in s])
|
||||||
|
|
||||||
|
|
||||||
|
def mergeStrings(a: str, b: str) -> str:
|
||||||
|
return "".join(
|
||||||
|
[rotateString(ca, sumOfValuesOfCharacters(cb)) for ca, cb in zip(a, b)]
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def decrypt(drmmessage):
|
||||||
|
half = len(drmmessage) // 2
|
||||||
|
a, b = drmmessage[:half], drmmessage[half:]
|
||||||
|
rota = rotateString(a, sumOfValuesOfCharacters(a))
|
||||||
|
rotb = rotateString(b, sumOfValuesOfCharacters(b))
|
||||||
|
return mergeStrings(rota, rotb)
|
||||||
|
|
||||||
|
|
||||||
|
print(decrypt(input()))
|
||||||
19
easiest.py
Normal file
19
easiest.py
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
def sumOfDigits(n: int) -> int:
|
||||||
|
sod = 0
|
||||||
|
while True:
|
||||||
|
sod += n % 10
|
||||||
|
n = n // 10
|
||||||
|
if n == 0:
|
||||||
|
return sod
|
||||||
|
|
||||||
|
|
||||||
|
n = int(input())
|
||||||
|
while n:
|
||||||
|
sodn = sumOfDigits(n)
|
||||||
|
p = 11
|
||||||
|
while True:
|
||||||
|
if sodn == sumOfDigits(n * p):
|
||||||
|
print(p)
|
||||||
|
break
|
||||||
|
p += 1
|
||||||
|
n = int(input())
|
||||||
3
ekkidaudi.py
Normal file
3
ekkidaudi.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
row1 = input().strip().split("|")
|
||||||
|
row2 = input().strip().split("|")
|
||||||
|
print(" ".join(["".join(part) for part in zip(row1, row2)]))
|
||||||
8
encodedmessage.py
Normal file
8
encodedmessage.py
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
def decode(s: str) -> str:
|
||||||
|
w = int(len(s) ** 0.5)
|
||||||
|
return "".join([s[v * w + h] for h in range(w) for v in range(w - 1, -1, -1)][::-1])
|
||||||
|
|
||||||
|
|
||||||
|
n = int(input())
|
||||||
|
for _ in range(n):
|
||||||
|
print(decode(input()))
|
||||||
17
epigdanceoff.py
Normal file
17
epigdanceoff.py
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
n, m = map(int, input().split())
|
||||||
|
|
||||||
|
lines = []
|
||||||
|
for _ in range(n):
|
||||||
|
lines.append(input())
|
||||||
|
|
||||||
|
t = 1
|
||||||
|
for col in range(m):
|
||||||
|
new_frame = True
|
||||||
|
for row in lines:
|
||||||
|
if row[col] != "_":
|
||||||
|
new_frame = False
|
||||||
|
break
|
||||||
|
if new_frame:
|
||||||
|
t += 1
|
||||||
|
|
||||||
|
print(t)
|
||||||
14
fallingsnow2.py
Normal file
14
fallingsnow2.py
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
n, m = map(int, input().split())
|
||||||
|
|
||||||
|
snows = [
|
||||||
|
0,
|
||||||
|
] * m
|
||||||
|
|
||||||
|
for _ in range(n):
|
||||||
|
for i, x in enumerate(input()):
|
||||||
|
snows[i] += 1 if x == "S" else 0
|
||||||
|
|
||||||
|
for r in range(n):
|
||||||
|
for c in range(m):
|
||||||
|
print("S" if snows[c] >= n - r else ".", end="")
|
||||||
|
print()
|
||||||
3
fifa.py
Normal file
3
fifa.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
n = int(input())
|
||||||
|
k = int(input())
|
||||||
|
print(2022 + n // k)
|
||||||
11
fiftyshades.py
Normal file
11
fiftyshades.py
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
n = int(input())
|
||||||
|
training_sessions = 0
|
||||||
|
for _ in range(n):
|
||||||
|
color_name = input().lower()
|
||||||
|
if "pink" in color_name or "rose" in color_name:
|
||||||
|
training_sessions += 1
|
||||||
|
print(
|
||||||
|
training_sessions
|
||||||
|
if training_sessions > 0
|
||||||
|
else "I must watch Star Wars with my daughter"
|
||||||
|
)
|
||||||
1
flatbokuveisla.py
Normal file
1
flatbokuveisla.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
print(int(input()) % int(input()))
|
||||||
21
fodelsedagsmemorisering.py
Normal file
21
fodelsedagsmemorisering.py
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
n = int(input())
|
||||||
|
|
||||||
|
memory = {}
|
||||||
|
names = []
|
||||||
|
for _ in range(n):
|
||||||
|
name, likes, birthday = input().split()
|
||||||
|
likes = int(likes)
|
||||||
|
|
||||||
|
if birthday in memory.keys():
|
||||||
|
if memory[birthday][1] < likes:
|
||||||
|
names.remove(memory[birthday][0])
|
||||||
|
memory[birthday] = (name, likes)
|
||||||
|
names.append(name)
|
||||||
|
else:
|
||||||
|
memory[birthday] = (name, likes)
|
||||||
|
names.append(name)
|
||||||
|
|
||||||
|
print(len(memory.keys()))
|
||||||
|
names.sort()
|
||||||
|
for name in names:
|
||||||
|
print(name)
|
||||||
4
forcedchoice.py
Normal file
4
forcedchoice.py
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
n, p, s = map(int, input().split())
|
||||||
|
for _ in range(s):
|
||||||
|
cards = list(map(int, input().split()))[1:]
|
||||||
|
print("KEEP" if p in cards else "REMOVE")
|
||||||
56
glitchbot.py
Normal file
56
glitchbot.py
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
NORTH = 0
|
||||||
|
EAST = 1
|
||||||
|
SOUTH = 2
|
||||||
|
WEST = 3
|
||||||
|
|
||||||
|
LEFT = 0
|
||||||
|
RIGHT = 1
|
||||||
|
FORWARD = 2
|
||||||
|
|
||||||
|
|
||||||
|
def run_program(program: list) -> tuple:
|
||||||
|
x, y = 0, 0
|
||||||
|
facing = NORTH
|
||||||
|
|
||||||
|
for instruction in program:
|
||||||
|
if instruction == LEFT:
|
||||||
|
facing = (facing - 1) % 4
|
||||||
|
|
||||||
|
elif instruction == RIGHT:
|
||||||
|
facing = (facing + 1) % 4
|
||||||
|
|
||||||
|
elif instruction == FORWARD:
|
||||||
|
if facing == NORTH:
|
||||||
|
y += 1
|
||||||
|
elif facing == SOUTH:
|
||||||
|
y -= 1
|
||||||
|
elif facing == EAST:
|
||||||
|
x += 1
|
||||||
|
elif facing == WEST:
|
||||||
|
x -= 1
|
||||||
|
|
||||||
|
return x, y
|
||||||
|
|
||||||
|
|
||||||
|
x, y = map(int, input().split())
|
||||||
|
instruction_count = int(input())
|
||||||
|
|
||||||
|
program = []
|
||||||
|
for _ in range(instruction_count):
|
||||||
|
instruction = input()
|
||||||
|
if instruction == "Left":
|
||||||
|
program.append(LEFT)
|
||||||
|
elif instruction == "Right":
|
||||||
|
program.append(RIGHT)
|
||||||
|
elif instruction == "Forward":
|
||||||
|
program.append(FORWARD)
|
||||||
|
|
||||||
|
for i in range(len(program)):
|
||||||
|
for _ in range(3):
|
||||||
|
program[i] = (program[i] + 1) % 3
|
||||||
|
result = run_program(program)
|
||||||
|
if result == (x, y):
|
||||||
|
print(
|
||||||
|
f"{i+1} {'Left' if program[i] == LEFT else 'Right' if program[i] == RIGHT else 'Forward'}"
|
||||||
|
)
|
||||||
|
exit()
|
||||||
9
goombastacks.py
Normal file
9
goombastacks.py
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
n = int(input())
|
||||||
|
g_total = 0
|
||||||
|
for _ in range(n):
|
||||||
|
g, b = map(int, input().split())
|
||||||
|
g_total += g
|
||||||
|
if b > g_total:
|
||||||
|
print("impossible")
|
||||||
|
exit()
|
||||||
|
print("possible")
|
||||||
14
grading.py
Normal file
14
grading.py
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
a, b, c, d, e = map(int, input().split())
|
||||||
|
score = int(input())
|
||||||
|
if score >= a:
|
||||||
|
print("A")
|
||||||
|
elif score >= b:
|
||||||
|
print("B")
|
||||||
|
elif score >= c:
|
||||||
|
print("C")
|
||||||
|
elif score >= d:
|
||||||
|
print("D")
|
||||||
|
elif score >= e:
|
||||||
|
print("E")
|
||||||
|
else:
|
||||||
|
print("F")
|
||||||
28
heirsdilemma.py
Normal file
28
heirsdilemma.py
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
def div_by_all(nr: int) -> bool:
|
||||||
|
digits = nr
|
||||||
|
for i in range(1, 7):
|
||||||
|
digit = digits % (10**i)
|
||||||
|
if nr % (digit // (10 ** (i - 1))) != 0:
|
||||||
|
return False
|
||||||
|
digits -= digit
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
low, high = map(int, input().split())
|
||||||
|
|
||||||
|
if low % 2 == 1:
|
||||||
|
low += 1
|
||||||
|
|
||||||
|
total = 0
|
||||||
|
|
||||||
|
for i in range(low, high + 1, 2):
|
||||||
|
u = set(str(i))
|
||||||
|
if len(u) != len(str(i)):
|
||||||
|
continue
|
||||||
|
if "0" in u:
|
||||||
|
continue
|
||||||
|
|
||||||
|
if div_by_all(i):
|
||||||
|
total += 1
|
||||||
|
|
||||||
|
print(total)
|
||||||
6
helpaphd.py
Normal file
6
helpaphd.py
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
for _ in range(int(input())):
|
||||||
|
testcase = input()
|
||||||
|
if testcase == "P=NP":
|
||||||
|
print("skipped")
|
||||||
|
else:
|
||||||
|
print(sum(map(int, testcase.split("+"))))
|
||||||
5
herman.py
Normal file
5
herman.py
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
import math
|
||||||
|
|
||||||
|
r = int(input())
|
||||||
|
print(r**2 * math.pi)
|
||||||
|
print(r**2 * 2)
|
||||||
1
hipphipp.py
Normal file
1
hipphipp.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
print("Hipp hipp hurra!\n" * 20)
|
||||||
3
hipphipphurra.py
Normal file
3
hipphipphurra.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
name = input()
|
||||||
|
age = int(input())
|
||||||
|
print(f"Hipp hipp hurra, {name}!\n" * age)
|
||||||
10
hiptobesquare.py
Normal file
10
hiptobesquare.py
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
t = int(input())
|
||||||
|
|
||||||
|
for _ in range(t):
|
||||||
|
n = int(input()) + 1
|
||||||
|
max_size = int(n**0.5)
|
||||||
|
if max_size % 2 == 0:
|
||||||
|
max_size -= 2
|
||||||
|
else:
|
||||||
|
max_size -= 1
|
||||||
|
print(max_size // 2)
|
||||||
32
hittingtargets.py
Normal file
32
hittingtargets.py
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
def isInsideCircle(cx, cy, r, x, y):
|
||||||
|
dist = (x - cx) ** 2 + (y - cy) ** 2
|
||||||
|
return dist <= r**2
|
||||||
|
|
||||||
|
|
||||||
|
def isInsideRectangle(rx1, ry1, rx2, ry2, x, y):
|
||||||
|
return (rx1 <= x <= rx2) and (ry1 <= y <= ry2)
|
||||||
|
|
||||||
|
|
||||||
|
targets = []
|
||||||
|
for _ in range(int(input())):
|
||||||
|
t = input().split()
|
||||||
|
if t[0] == "rectangle":
|
||||||
|
targets.append(["R", int(t[1]), int(t[2]), int(t[3]), int(t[4])])
|
||||||
|
else:
|
||||||
|
targets.append(["C", int(t[1]), int(t[2]), int(t[3])])
|
||||||
|
|
||||||
|
for _ in range(int(input())):
|
||||||
|
x, y = map(int, input().split())
|
||||||
|
hits = 0
|
||||||
|
|
||||||
|
for target in targets:
|
||||||
|
if target[0] == "R":
|
||||||
|
hits += (
|
||||||
|
1
|
||||||
|
if isInsideRectangle(target[1], target[2], target[3], target[4], x, y)
|
||||||
|
else 0
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
hits += 1 if isInsideCircle(target[1], target[2], target[3], x, y) else 0
|
||||||
|
|
||||||
|
print(hits)
|
||||||
2
hradgreining.py
Normal file
2
hradgreining.py
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
DNA = input()
|
||||||
|
print("Veikur!" if "COV" in DNA else "Ekki veikur!")
|
||||||
12
humancannonball2.py
Normal file
12
humancannonball2.py
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
from math import cos, sin, radians
|
||||||
|
|
||||||
|
n = int(input())
|
||||||
|
|
||||||
|
for _ in range(n):
|
||||||
|
v0, angle, x1, h1, h2 = map(float, input().split())
|
||||||
|
t = x1 / v0 / cos(radians(angle))
|
||||||
|
yt = v0 * t * sin(radians(angle)) - 0.5 * 9.81 * t**2
|
||||||
|
if h1 + 1 < yt < h2 - 1:
|
||||||
|
print("Safe")
|
||||||
|
else:
|
||||||
|
print("Not Safe")
|
||||||
12
icpcawards.py
Normal file
12
icpcawards.py
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
n = int(input())
|
||||||
|
unis = []
|
||||||
|
teams = []
|
||||||
|
|
||||||
|
for i in range(n):
|
||||||
|
uni, team = input().split()
|
||||||
|
if uni not in unis:
|
||||||
|
unis.append(uni)
|
||||||
|
teams.append(team)
|
||||||
|
|
||||||
|
for i in range(12):
|
||||||
|
print(f"{unis[i]} {teams[i]}")
|
||||||
7
internationaldates.py
Normal file
7
internationaldates.py
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
a, b, c = map(int, input().split("/"))
|
||||||
|
if a <= 12 and b <= 12:
|
||||||
|
print("either")
|
||||||
|
elif a <= 12:
|
||||||
|
print("US")
|
||||||
|
else:
|
||||||
|
print("EU")
|
||||||
4
janitortroubles.py
Normal file
4
janitortroubles.py
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
a, b, c, d = map(int, input().split())
|
||||||
|
s = (a + b + c + d) / 2
|
||||||
|
k = ((s - a) * (s - b) * (s - c) * (s - d)) ** 0.5
|
||||||
|
print(k)
|
||||||
4
jobexpenses.py
Normal file
4
jobexpenses.py
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
n = int(input())
|
||||||
|
k = map(int, input().split())
|
||||||
|
k = [abs(i) for i in k if i < 0]
|
||||||
|
print(sum(k))
|
||||||
5
jointjogjam.py
Normal file
5
jointjogjam.py
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
ksx, ksy, osx, osy, kex, key, oex, oey = map(int, input().split())
|
||||||
|
|
||||||
|
d1 = ((ksx - osx) ** 2 + (ksy - osy) ** 2) ** (0.5)
|
||||||
|
d2 = ((kex - oex) ** 2 + (key - oey) ** 2) ** (0.5)
|
||||||
|
print(max((d1, d2)))
|
||||||
7
judgingmoose.py
Normal file
7
judgingmoose.py
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
l, r = map(int, input().split())
|
||||||
|
if l == r == 0:
|
||||||
|
print("Not a moose")
|
||||||
|
elif l == r:
|
||||||
|
print(f"Even {l+r}")
|
||||||
|
else:
|
||||||
|
print(f"Odd {max((l, r)) * 2}")
|
||||||
9
karte.py
Normal file
9
karte.py
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
cards = input()
|
||||||
|
cards = [cards[i : i + 3] for i in range(0, len(cards), 3)]
|
||||||
|
unique_cards = set(cards)
|
||||||
|
if len(cards) > len(unique_cards):
|
||||||
|
print("GRESKA")
|
||||||
|
else:
|
||||||
|
for suit in ('P', 'K', 'H', 'T'):
|
||||||
|
print(13-len([card for card in cards if card[0] == suit]), end=' ')
|
||||||
|
|
||||||
13
kleptography.py
Normal file
13
kleptography.py
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
n, m = map(int, input().split())
|
||||||
|
knowntext = input()
|
||||||
|
ciphertext = input()
|
||||||
|
plaintext = [""] * m
|
||||||
|
for i in range(n):
|
||||||
|
plaintext[-n + i] = knowntext[i]
|
||||||
|
|
||||||
|
for i in range(m - 1, -1, -1):
|
||||||
|
char = chr((ord(ciphertext[i]) - ord(plaintext[i])) % 26 + 97)
|
||||||
|
if i - n >= 0:
|
||||||
|
plaintext[i - n] = char
|
||||||
|
|
||||||
|
print("".join(plaintext))
|
||||||
4
knotknowledge.py
Normal file
4
knotknowledge.py
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
_ = input()
|
||||||
|
knots = set(map(int, input().split()))
|
||||||
|
learnedknots = set(map(int, input().split()))
|
||||||
|
print(list(knots.difference(learnedknots))[0])
|
||||||
2
kornislav.py
Normal file
2
kornislav.py
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
ints = sorted(list(map(int, input().split())))
|
||||||
|
print(ints[0] * ints[2])
|
||||||
4
ladder.py
Normal file
4
ladder.py
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
from math import radians, sin, ceil
|
||||||
|
|
||||||
|
h, v = map(int, input().split())
|
||||||
|
print(ceil(h / sin(radians(v))))
|
||||||
2
laptopsticker.py
Normal file
2
laptopsticker.py
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
wc, hc, ws, hs = map(int, input().split())
|
||||||
|
print(0 if ws + 2 > wc or hs + 2 > hc else 1)
|
||||||
1
leggjasaman.py
Normal file
1
leggjasaman.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
print(int(input()) + int(input()))
|
||||||
3
licensetolaunch.py
Normal file
3
licensetolaunch.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
_ = input()
|
||||||
|
junk = list(map(int, input().split()))
|
||||||
|
print(junk.index(min(junk)))
|
||||||
11
loorolls.py
Normal file
11
loorolls.py
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
L, N = map(int, input().split())
|
||||||
|
|
||||||
|
rollen = 0
|
||||||
|
prev_taken = 0
|
||||||
|
while True:
|
||||||
|
rollen += 1
|
||||||
|
restant = L % (N - prev_taken)
|
||||||
|
if restant == 0:
|
||||||
|
print(rollen)
|
||||||
|
exit()
|
||||||
|
prev_taken += restant
|
||||||
4
lostlineup.py
Normal file
4
lostlineup.py
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
n = int(input())
|
||||||
|
d = list(map(int, input().split()))
|
||||||
|
pos = [1] + [d.index(i) + 2 for i in range(n - 1)]
|
||||||
|
print(" ".join(map(str, pos)))
|
||||||
1
lubbilaerir.py
Normal file
1
lubbilaerir.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
print(input()[0])
|
||||||
21
luhnchecksum.py
Normal file
21
luhnchecksum.py
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
def luhn_checksum(card_number):
|
||||||
|
def digits_of(n):
|
||||||
|
return [int(d) for d in str(n)]
|
||||||
|
|
||||||
|
digits = digits_of(card_number)
|
||||||
|
odd_digits = digits[-1::-2]
|
||||||
|
even_digits = digits[-2::-2]
|
||||||
|
checksum = 0
|
||||||
|
checksum += sum(odd_digits)
|
||||||
|
for d in even_digits:
|
||||||
|
checksum += sum(digits_of(d * 2))
|
||||||
|
return checksum % 10
|
||||||
|
|
||||||
|
|
||||||
|
def is_luhn_valid(card_number):
|
||||||
|
return luhn_checksum(card_number) == 0
|
||||||
|
|
||||||
|
|
||||||
|
n = int(input())
|
||||||
|
for _ in range(n):
|
||||||
|
print("PASS" if is_luhn_valid(input()) else "FAIL")
|
||||||
6
maptiles2.py
Normal file
6
maptiles2.py
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
quadkey = input()
|
||||||
|
zoomlevel = len(quadkey)
|
||||||
|
interleaved_coordinates = format(int(quadkey, 4), f"0{zoomlevel*2}b")
|
||||||
|
y = "".join([interleaved_coordinates[i] for i in range(0, zoomlevel * 2, 2)])
|
||||||
|
x = "".join([interleaved_coordinates[i] for i in range(1, zoomlevel * 2, 2)])
|
||||||
|
print(zoomlevel, int(x, 2), int(y, 2))
|
||||||
5
mergjadmal.py
Normal file
5
mergjadmal.py
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
s = input()
|
||||||
|
if "69" in s or "420" in s:
|
||||||
|
print("Mergjad!")
|
||||||
|
else:
|
||||||
|
print("Leim!")
|
||||||
5
mixedfractions.py
Normal file
5
mixedfractions.py
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
n, d = map(int, input().split())
|
||||||
|
|
||||||
|
while not (n == d == 0):
|
||||||
|
print(f"{n // d} {n % d} / {d}")
|
||||||
|
n, d = map(int, input().split())
|
||||||
7
moderatepace.py
Normal file
7
moderatepace.py
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
n = int(input())
|
||||||
|
k = list(map(int, input().split()))
|
||||||
|
a = list(map(int, input().split()))
|
||||||
|
b = list(map(int, input().split()))
|
||||||
|
|
||||||
|
for i in range(n):
|
||||||
|
print(f"{sorted([k[i], a[i], b[i]])[1]} ", end="")
|
||||||
23
nop.py
Normal file
23
nop.py
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
UPPERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||||
|
|
||||||
|
instructions = input().strip()
|
||||||
|
|
||||||
|
i = 0
|
||||||
|
nop_count = 0
|
||||||
|
|
||||||
|
while True:
|
||||||
|
try:
|
||||||
|
if instructions[i + 1] in UPPERS:
|
||||||
|
nop_count += 3
|
||||||
|
i += 1
|
||||||
|
elif instructions[i + 2] in UPPERS:
|
||||||
|
nop_count += 2
|
||||||
|
i += 2
|
||||||
|
elif instructions[i + 3] in UPPERS:
|
||||||
|
nop_count += 1
|
||||||
|
i += 3
|
||||||
|
else:
|
||||||
|
i += 4
|
||||||
|
except IndexError:
|
||||||
|
print(nop_count)
|
||||||
|
exit()
|
||||||
5
parking2.py
Normal file
5
parking2.py
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
t = int(input())
|
||||||
|
for _ in range(t):
|
||||||
|
n = int(input())
|
||||||
|
x = list(map(int, input().split()))
|
||||||
|
print((max(x) - min(x)) * 2)
|
||||||
22
prsteni.py
Normal file
22
prsteni.py
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
import math
|
||||||
|
|
||||||
|
n = int(input())
|
||||||
|
radii = list(map(int, input().split()))
|
||||||
|
|
||||||
|
prev_r = None
|
||||||
|
prev_n = 1
|
||||||
|
prev_d = 1
|
||||||
|
for r in radii:
|
||||||
|
if prev_r is None:
|
||||||
|
prev_r = r
|
||||||
|
continue
|
||||||
|
|
||||||
|
n = prev_r * prev_n
|
||||||
|
d = r * prev_d
|
||||||
|
gcd = math.gcd(n, d)
|
||||||
|
n = n // gcd
|
||||||
|
d = d // gcd
|
||||||
|
print(f"{n}/{d}")
|
||||||
|
prev_n = n
|
||||||
|
prev_d = d
|
||||||
|
prev_r = r
|
||||||
23
ptice.py
Normal file
23
ptice.py
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
ADRIAN = "ABC" * 34
|
||||||
|
BRUNO = "BABC" * 25
|
||||||
|
GORAN = "CCAABB" * 17
|
||||||
|
|
||||||
|
n = int(input())
|
||||||
|
answers = input()
|
||||||
|
adrian_score = bruno_score = goran_score = 0
|
||||||
|
for i in range(n):
|
||||||
|
if answers[i] == ADRIAN[i]:
|
||||||
|
adrian_score += 1
|
||||||
|
if answers[i] == BRUNO[i]:
|
||||||
|
bruno_score += 1
|
||||||
|
if answers[i] == GORAN[i]:
|
||||||
|
goran_score += 1
|
||||||
|
|
||||||
|
max_score = max((adrian_score, bruno_score, goran_score))
|
||||||
|
print(max_score)
|
||||||
|
if adrian_score == max_score:
|
||||||
|
print("Adrian")
|
||||||
|
if bruno_score == max_score:
|
||||||
|
print("Bruno")
|
||||||
|
if goran_score == max_score:
|
||||||
|
print("Goran")
|
||||||
3
quickestimate.py
Normal file
3
quickestimate.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
n = int(input())
|
||||||
|
for _ in range(n):
|
||||||
|
print(len(input()))
|
||||||
20
racingalphabet.py
Normal file
20
racingalphabet.py
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
import math
|
||||||
|
|
||||||
|
|
||||||
|
def calculate_distance(aphorism: str) -> int:
|
||||||
|
tokens = "ABCDEFGHIJKLMNOPQRSTUVWXYZ '"
|
||||||
|
prev_s = aphorism[0]
|
||||||
|
total_distance = 0
|
||||||
|
for s in aphorism:
|
||||||
|
current_distance = (tokens.index(prev_s) - tokens.index(s)) % 28
|
||||||
|
if current_distance > 14:
|
||||||
|
current_distance = 28 - current_distance
|
||||||
|
prev_s = s
|
||||||
|
total_distance += current_distance
|
||||||
|
return 60 * math.pi / 28 * total_distance
|
||||||
|
|
||||||
|
|
||||||
|
n = int(input())
|
||||||
|
for _ in range(n):
|
||||||
|
aphorism = input()
|
||||||
|
print(calculate_distance(aphorism) / 15 + len(aphorism))
|
||||||
2
rectanglearea.py
Normal file
2
rectanglearea.py
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
x1, y1, x2, y2 = map(float, input().split())
|
||||||
|
print(abs((x1 - x2) * (y1 - y2)))
|
||||||
3
reduplikation.py
Normal file
3
reduplikation.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
s = input()
|
||||||
|
r = int(input())
|
||||||
|
print(s * r)
|
||||||
12
rijeci.py
Normal file
12
rijeci.py
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
k = int(input())
|
||||||
|
|
||||||
|
|
||||||
|
def get_sequence(n):
|
||||||
|
seq = [1, 0]
|
||||||
|
for _ in range(1, n + 1):
|
||||||
|
seq.append(seq[-1] + seq[-2])
|
||||||
|
return seq
|
||||||
|
|
||||||
|
|
||||||
|
seq = get_sequence(k)
|
||||||
|
print(f"{seq[-2]} {seq[-1]}")
|
||||||
27
risdomare.py
Normal file
27
risdomare.py
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
n = int(input())
|
||||||
|
prefer = input()
|
||||||
|
|
||||||
|
bi = 0
|
||||||
|
bt = 0
|
||||||
|
ba = 0
|
||||||
|
bs = 0
|
||||||
|
|
||||||
|
|
||||||
|
for i in range(n):
|
||||||
|
a, s = map(int, input().split())
|
||||||
|
if bt > a + s:
|
||||||
|
continue
|
||||||
|
elif bt == a + s and prefer == "antal" and a > ba:
|
||||||
|
bi = i + 1
|
||||||
|
ba = a
|
||||||
|
bs = s
|
||||||
|
elif bt == a + s and s > bs:
|
||||||
|
bi = i + 1
|
||||||
|
ba = a
|
||||||
|
bs = s
|
||||||
|
elif bt < a + s:
|
||||||
|
bi = i + 1
|
||||||
|
bt = a + s
|
||||||
|
ba = a
|
||||||
|
bs = s
|
||||||
|
print(bi)
|
||||||
17
schoolspirit.py
Normal file
17
schoolspirit.py
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
n = int(input())
|
||||||
|
scores = [int(input()) for _ in range(n)]
|
||||||
|
|
||||||
|
|
||||||
|
def calculate_score(scores: list) -> float:
|
||||||
|
return (1 / 5) * sum([score * ((4 / 5) ** i) for i, score in enumerate(scores)])
|
||||||
|
|
||||||
|
|
||||||
|
print(calculate_score(scores))
|
||||||
|
|
||||||
|
new_scores = []
|
||||||
|
for score in scores:
|
||||||
|
cpy_scores = scores.copy()
|
||||||
|
cpy_scores.remove(score)
|
||||||
|
new_scores.append(calculate_score(cpy_scores))
|
||||||
|
|
||||||
|
print(sum(new_scores) / len(new_scores))
|
||||||
25
securedoors.py
Normal file
25
securedoors.py
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
state = {}
|
||||||
|
|
||||||
|
|
||||||
|
def detect_anomaly(name: str, action: str) -> str:
|
||||||
|
global state
|
||||||
|
try:
|
||||||
|
if state[name] == action:
|
||||||
|
return " (ANOMALY)"
|
||||||
|
except KeyError:
|
||||||
|
if action == "exit":
|
||||||
|
return " (ANOMALY)"
|
||||||
|
return ""
|
||||||
|
|
||||||
|
|
||||||
|
def print_log(name: str, action: str) -> None:
|
||||||
|
paction = "entered" if action == "entry" else "exited"
|
||||||
|
print(f"{name} {paction}{detect_anomaly(name, action)}")
|
||||||
|
|
||||||
|
|
||||||
|
n = int(input())
|
||||||
|
|
||||||
|
for _ in range(n):
|
||||||
|
action, name = input().split()
|
||||||
|
print_log(name, action)
|
||||||
|
state[name] = action
|
||||||
10
server.py
Normal file
10
server.py
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
n, t = map(int, input().split())
|
||||||
|
tasks = list(map(int, input().split()))
|
||||||
|
|
||||||
|
total_t = 0
|
||||||
|
for i, task in enumerate(tasks):
|
||||||
|
total_t += task
|
||||||
|
if total_t > t:
|
||||||
|
print(i)
|
||||||
|
exit()
|
||||||
|
print(i + 1)
|
||||||
7
sevenwonders.py
Normal file
7
sevenwonders.py
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
s = input().strip()
|
||||||
|
|
||||||
|
t = s.count("T")
|
||||||
|
c = s.count("C")
|
||||||
|
g = s.count("G")
|
||||||
|
|
||||||
|
print(t**2 + c**2 + g**2 + (min((t, c, g)) * 7))
|
||||||
7
simon.py
Normal file
7
simon.py
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
t = int(input())
|
||||||
|
for _ in range(t):
|
||||||
|
s = input()
|
||||||
|
if s[:10] == 'simon says':
|
||||||
|
print(s[11:])
|
||||||
|
else:
|
||||||
|
print()
|
||||||
11
sith.py
Normal file
11
sith.py
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
_ = input()
|
||||||
|
a = int(input())
|
||||||
|
b = int(input())
|
||||||
|
res = int(input())
|
||||||
|
|
||||||
|
if a - b >= 0:
|
||||||
|
print("VEIT EKKI")
|
||||||
|
elif res > 0:
|
||||||
|
print("SITH")
|
||||||
|
else:
|
||||||
|
print("JEDI")
|
||||||
3
skak.py
Normal file
3
skak.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
x1, y1 = map(int, input().split())
|
||||||
|
x2, y2 = map(int, input().split())
|
||||||
|
print(1 if x1 == x2 or y1 == y2 else 2)
|
||||||
16
skener.py
Normal file
16
skener.py
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
r, c, zr, zc = map(int, input().split())
|
||||||
|
|
||||||
|
rows = []
|
||||||
|
for _ in range(r):
|
||||||
|
row = input()
|
||||||
|
new_row = []
|
||||||
|
for c in row:
|
||||||
|
new_row += [
|
||||||
|
c,
|
||||||
|
] * zc
|
||||||
|
rows += [
|
||||||
|
new_row,
|
||||||
|
] * zr
|
||||||
|
|
||||||
|
for row in rows:
|
||||||
|
print("".join(row))
|
||||||
2
skocimis.py
Normal file
2
skocimis.py
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
ints = list(map(int, input().split()))
|
||||||
|
print(max((ints[1] - ints[0], ints[2] - ints[1]))-1)
|
||||||
23
sortofsorting.py
Normal file
23
sortofsorting.py
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
from functools import cmp_to_key
|
||||||
|
|
||||||
|
n = int(input())
|
||||||
|
|
||||||
|
|
||||||
|
def sorting_method(a, b):
|
||||||
|
if ord(a[0]) > ord(b[0]):
|
||||||
|
return 1
|
||||||
|
elif ord(a[0]) < ord(b[0]):
|
||||||
|
return -1
|
||||||
|
elif ord(a[1]) > ord(b[1]):
|
||||||
|
return 1
|
||||||
|
elif ord(a[1]) < ord(b[1]):
|
||||||
|
return -1
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
while n:
|
||||||
|
names = sorted([input() for _ in range(n)], key=cmp_to_key(sorting_method))
|
||||||
|
for name in names:
|
||||||
|
print(name)
|
||||||
|
print()
|
||||||
|
n = int(input())
|
||||||
3
sottkvi.py
Normal file
3
sottkvi.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
n, k, d = map(int, input().strip().split())
|
||||||
|
birthday = d + k
|
||||||
|
print(sum([1 if int(input()) + 14 <= birthday else 0 for _ in range(n)]))
|
||||||
18
speeding.py
Normal file
18
speeding.py
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
n = int(input())
|
||||||
|
|
||||||
|
prev_t = prev_d = None
|
||||||
|
max_speed = 0
|
||||||
|
for _ in range(n):
|
||||||
|
t, d = map(int, input().split())
|
||||||
|
|
||||||
|
if prev_t is None:
|
||||||
|
prev_t = t
|
||||||
|
prev_d = d
|
||||||
|
continue
|
||||||
|
|
||||||
|
speed = (d - prev_d) / (t - prev_t)
|
||||||
|
max_speed = max((speed, max_speed))
|
||||||
|
prev_t = t
|
||||||
|
prev_d = d
|
||||||
|
|
||||||
|
print(int(max_speed))
|
||||||
19
spellingbee.py
Normal file
19
spellingbee.py
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
letters = input()
|
||||||
|
n = int(input())
|
||||||
|
|
||||||
|
|
||||||
|
def check_word(word: str, letters: str) -> bool:
|
||||||
|
for letter in word:
|
||||||
|
if letter not in letters:
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
for _ in range(n):
|
||||||
|
word = input()
|
||||||
|
if 4 > len(word):
|
||||||
|
continue
|
||||||
|
if letters[0] not in word:
|
||||||
|
continue
|
||||||
|
if check_word(word, letters):
|
||||||
|
print(word)
|
||||||
2
spritt.py
Normal file
2
spritt.py
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
n, x = map(int, input().strip().split())
|
||||||
|
print("Jebb" if sum([int(input()) for _ in range(n)]) <= x else "Neibb")
|
||||||
1
storafmaeli.py
Normal file
1
storafmaeli.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
print("Jebb" if int(input()) % 10 == 0 else "Neibb")
|
||||||
18
symmetricorder.py
Normal file
18
symmetricorder.py
Normal 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
19
taisformula.py
Normal 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)
|
||||||
8
takkar.py
Normal file
8
takkar.py
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
a = int(input())
|
||||||
|
b = int(input())
|
||||||
|
if a > b:
|
||||||
|
print("MAGA!")
|
||||||
|
elif b > a:
|
||||||
|
print("FAKE NEWS!")
|
||||||
|
else:
|
||||||
|
print("WORLD WAR 3!")
|
||||||
13
temperatureconfusion.py
Normal file
13
temperatureconfusion.py
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
from math import gcd
|
||||||
|
|
||||||
|
fnumerator, fdenominator = map(int, input().split("/"))
|
||||||
|
|
||||||
|
cnumerator = fnumerator - (fdenominator * 32)
|
||||||
|
negative = cnumerator < 0
|
||||||
|
cnumerator = abs(cnumerator)
|
||||||
|
cnumerator *= 5
|
||||||
|
cdenominator = fdenominator * 9
|
||||||
|
|
||||||
|
gcdiv = gcd(cnumerator, cdenominator)
|
||||||
|
print("-" if negative else "", end="")
|
||||||
|
print(f"{cnumerator//gcdiv}/{cdenominator//gcdiv}")
|
||||||
2
tetration.py
Normal file
2
tetration.py
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
n = float(input())
|
||||||
|
print(n ** (1 / n))
|
||||||
2
thelastproblem.py
Normal file
2
thelastproblem.py
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
s = input()
|
||||||
|
print(f"Thank you, {s}, and farewell!")
|
||||||
1
tilhamingju.py
Normal file
1
tilhamingju.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
print("TIL HAMINGJU MED AFMAELID FORRITUNARKEPPNI FRAMHALDSSKOLANNA!")
|
||||||
1
tolvunarfraedingartelja.py
Normal file
1
tolvunarfraedingartelja.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
print(int(input()) - 1)
|
||||||
6
tripletexting.py
Normal file
6
tripletexting.py
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
s = input()
|
||||||
|
wordlen = len(s) // 3
|
||||||
|
s1 = s[:wordlen]
|
||||||
|
s2 = s[wordlen : wordlen * 2]
|
||||||
|
s3 = s[wordlen * 2 :]
|
||||||
|
print(s1 if s1 == s2 or s1 == s3 else s2)
|
||||||
11
upprodun.py
Normal file
11
upprodun.py
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
n = int(input())
|
||||||
|
m = int(input())
|
||||||
|
|
||||||
|
teamsize = m // n
|
||||||
|
extras = m % n
|
||||||
|
|
||||||
|
for i in range(n):
|
||||||
|
if i < extras:
|
||||||
|
print("*" * (teamsize + 1))
|
||||||
|
else:
|
||||||
|
print("*" * teamsize)
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user