Skip to content

Commit

Permalink
add examples
Browse files Browse the repository at this point in the history
  • Loading branch information
zehengl committed Nov 12, 2024
1 parent c26f4bb commit 65b7eca
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/airfaregrants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
n = int(input())
p = [int(input()) for _ in range(n)]
print(max(0, min(p) - max(p) // 2))
27 changes: 27 additions & 0 deletions src/ooohisee.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
r, c = [int(d) for d in input().split()]
m = []
for _ in range(r):
m.append(input())

found = []
for i in range(1, r - 1):
for j in range(1, c - 1):
if (
m[i][j] == "0"
and m[i - 1][j] == "O"
and m[i][j - 1] == "O"
and m[i - 1][j - 1] == "O"
and m[i + 1][j] == "O"
and m[i][j + 1] == "O"
and m[i + 1][j + 1] == "O"
and m[i + 1][j - 1] == "O"
and m[i - 1][j + 1] == "O"
):
found.append((i + 1, j + 1))

if not found:
print("Oh no!")
elif len(found) > 1:
print(f"Oh no! {len(found)} locations")
else:
print(*found[0])
14 changes: 14 additions & 0 deletions src/sauna.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
n = int(input())
ma, mb = -1, 200001
for _ in range(n):
a, b = [int(d) for d in input().split()]
if a > ma:
ma = a
if b < mb:
mb = b
if ma > mb:
break
if ma <= mb:
print(mb - ma + 1, ma)
else:
print("bad news")
13 changes: 13 additions & 0 deletions src/whichnumberkindisit2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import math

t = int(input())
for _ in range(t):
n = int(input())
r = ""
if n % 2:
r += "O"
if math.sqrt(n).is_integer():
r += "S"
if not r:
r = "EMPTY"
print(r)

0 comments on commit 65b7eca

Please sign in to comment.