Compare commits

..

27 Commits

Author SHA1 Message Date
020015474f Easy problems solved on 2024-11-12 2024-11-12 22:53:08 +01:00
799f2283c7 GlitchBot 2023-11-15 22:47:23 +01:00
b58f0998db EpigDanceOff 2023-11-15 22:20:01 +01:00
ae55249b47 NOP 2023-11-15 22:10:55 +01:00
38610bdd11 Luhn's Checksum Algorithm 2023-10-17 22:46:33 +02:00
de8643b5f2 Loo Rolls 2023-10-17 22:34:39 +02:00
786cf4dc88 Joint Jog Jam 2023-10-17 22:10:00 +02:00
a3320343ef School Spirit 2023-10-17 21:50:25 +02:00
a309dad256 Triple Texting 2023-10-17 21:34:52 +02:00
f5925dedeb Birthday Memorization 2023-10-17 21:26:11 +02:00
2ebdbbc5b5 Goomba Stacks 2023-10-17 21:15:09 +02:00
986dc102d7 Arithmetic Functions 2023-10-17 21:08:16 +02:00
26347645b6 Basketball One-on-One 2023-10-17 20:59:27 +02:00
49a86bff16 Conformity 2023-10-17 20:42:54 +02:00
d661b76d6c Veður - Lokaðar heiðar 2023-10-16 22:46:40 +02:00
1fa5411107 Sóttkví 2023-10-16 22:27:28 +02:00
08da2c1c73 Sith 2023-10-16 22:19:02 +02:00
97bbb9503b Vefþjónatjón 2023-10-16 22:09:07 +02:00
03302ded7c Ekki dauði opna inni 2023-10-16 21:50:43 +02:00
6e1ab93478 Spritt 2023-10-16 21:36:35 +02:00
0dc3d6f827 Amerískur vinnustaður 2023-10-16 21:28:29 +02:00
6fa60c5f30 Hraðgreining 2023-10-16 21:25:01 +02:00
bdefb17596 Framtíðar FIFA 2023-10-16 21:20:51 +02:00
b21298e68c Viðsnúningur 2023-10-16 21:11:17 +02:00
8343b44c8d Óvissa 2023-10-16 21:07:55 +02:00
7977d3e82c Leggja saman 2023-10-16 21:04:54 +02:00
9d1e862202 Velkomin! 2023-10-16 21:01:41 +02:00
48 changed files with 407 additions and 0 deletions

4
aleidibio.py Normal file
View File

@@ -0,0 +1,4 @@
a = int(input())
b = int(input())
c = int(input())
print(c - a - b)

2
ameriskur.py Normal file
View File

@@ -0,0 +1,2 @@
length = float(input())
print(length * 0.09144)

21
arithmeticfunctions.cpp Normal file
View 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
View 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
View 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
View 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
View 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
View File

@@ -0,0 +1 @@
print(input())

21
conformity.py Normal file
View 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)

11
dfyrirdreki.py Normal file
View 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
View File

@@ -0,0 +1 @@
print(int(input()) - int(input()))

3
ekkidaudi.py Normal file
View File

@@ -0,0 +1,3 @@
row1 = input().strip().split("|")
row2 = input().strip().split("|")
print(" ".join(["".join(part) for part in zip(row1, row2)]))

17
epigdanceoff.py Normal file
View 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
View 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
View File

@@ -0,0 +1,3 @@
n = int(input())
k = int(input())
print(2022 + n // k)

1
flatbokuveisla.py Normal file
View File

@@ -0,0 +1 @@
print(int(input()) % int(input()))

View 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)

56
glitchbot.py Normal file
View 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
View 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")

1
hipphipp.py Normal file
View File

@@ -0,0 +1 @@
print("Hipp hipp hurra!\n" * 20)

3
hipphipphurra.py Normal file
View File

@@ -0,0 +1,3 @@
name = input()
age = int(input())
print(f"Hipp hipp hurra, {name}!\n" * age)

10
hiptobesquare.py Normal file
View 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)

2
hradgreining.py Normal file
View File

@@ -0,0 +1,2 @@
DNA = input()
print("Veikur!" if "COV" in DNA else "Ekki veikur!")

5
jointjogjam.py Normal file
View 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)))

1
kvedja.py Normal file
View File

@@ -0,0 +1 @@
print(f"Kvedja,\n{input()}")

1
leggjasaman.py Normal file
View File

@@ -0,0 +1 @@
print(int(input()) + int(input()))

11
loorolls.py Normal file
View 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

1
lubbilaerir.py Normal file
View File

@@ -0,0 +1 @@
print(input()[0])

21
luhnchecksum.py Normal file
View 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")

5
mergjadmal.py Normal file
View File

@@ -0,0 +1,5 @@
s = input()
if "69" in s or "420" in s:
print("Mergjad!")
else:
print("Leim!")

23
nop.py Normal file
View 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()

2
ovissa.py Normal file
View File

@@ -0,0 +1,2 @@
s = input().strip()
print(len(s))

3
reduplikation.py Normal file
View File

@@ -0,0 +1,3 @@
s = input()
r = int(input())
print(s * r)

17
schoolspirit.py Normal file
View 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))

11
sith.py Normal file
View 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
View 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)

3
sottkvi.py Normal file
View 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)]))

2
spritt.py Normal file
View 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
View File

@@ -0,0 +1 @@
print("Jebb" if int(input()) % 10 == 0 else "Neibb")

8
takkar.py Normal file
View 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!")

1
tilhamingju.py Normal file
View File

@@ -0,0 +1 @@
print("TIL HAMINGJU MED AFMAELID FORRITUNARKEPPNI FRAMHALDSSKOLANNA!")

View File

@@ -0,0 +1 @@
print(int(input()) - 1)

6
tripletexting.py Normal file
View 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)

6
vedurheidar.py Normal file
View File

@@ -0,0 +1,6 @@
v = int(input())
n = int(input())
for _ in range(n):
s, k = input().strip().split()
print(f"{s} {'opin' if int(k) >= v else 'lokud'}")

10
vefthjonatjon.py Normal file
View File

@@ -0,0 +1,10 @@
CPU = 0
MEM = 0
HDD = 0
n = int(input())
for _ in range(n):
c, m, h = map(lambda s: 1 if s == "J" else 0, input().strip().split())
CPU += c
MEM += m
HDD += h
print(min((CPU, MEM, HDD)))

1
velkomin.py Normal file
View File

@@ -0,0 +1 @@
print("VELKOMIN!")

1
vidsnuningur.py Normal file
View File

@@ -0,0 +1 @@
print(input()[::-1])

11
whichnumberkindisit2.py Normal file
View File

@@ -0,0 +1,11 @@
t = int(input())
for _ in range(t):
n = int(input())
out = ""
if n % 2 == 1:
out = "O"
if (n**0.5) % 1 == 0:
out += "S"
if out == "":
out = "EMPTY"
print(out)