Skip to content

Commit

Permalink
submetendo as resoluções dos exercícios da XVII maratona de programaç…
Browse files Browse the repository at this point in the history
…ão santo scuderi
  • Loading branch information
hyskoniho committed Jun 14, 2024
1 parent 0446f85 commit a158694
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 0 deletions.
10 changes: 10 additions & 0 deletions 1. Iniciante/3170.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from sys import stdin, stdout

b = int(stdin.readline().strip())
g = int(stdin.readline().strip())

quantidade_necessaria = g//2
if b>=quantidade_necessaria:
stdout.write("Amelia tem todas bolinhas!\n")
else:
stdout.write(f"Faltam {quantidade_necessaria-b} bolinha(s)\n")
17 changes: 17 additions & 0 deletions 2. AD-HOC/1397.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import sys

while (n := int(sys.stdin.readline().strip())) != 0:
ca = 0
cb = 0

for i in range(n):
l = sys.stdin.readline().strip()

a, b = [int(x) for x in l.split()]

if a>b:
ca+=1
elif b>a:
cb+=1

sys.stdout.write(f"{ca} {cb}\n")
25 changes: 25 additions & 0 deletions 2. AD-HOC/2448.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from sys import stdin, stdout

linha = stdin.readline().strip()
n, m = linha.split()

linha2 = stdin.readline().strip()
casas = [int(x) for x in linha2.split()]

linha3 = stdin.readline().strip()
encomendas = [int(x) for x in linha3.split()]

indices : dict[int, int] = {}
idx = 0
soma = 0


for i, casa in enumerate(casas):
indices[casa] = int(i)

for encomenda in encomendas:
casa = indices[encomenda]
soma+=abs(indices[encomenda] - idx)
idx = casa

stdout.write(str(soma) + '\n')
26 changes: 26 additions & 0 deletions 4. Estruturas e Bibliotecas/1449.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from sys import stdin, stdout

for t in range(int(stdin.readline().strip())):
m,n = stdin.readline().strip().split()

jap = []
trad = []

for x in range(int(m)):
jap.append(stdin.readline().strip())
trad.append(stdin.readline().strip())

musica = []

for x in range(int(n)):
linha = str(stdin.readline().strip())
lista_palavras = linha.split()
for idx, palavra in enumerate(lista_palavras):
for org, pt in zip(jap, trad):
if palavra == org:
lista_palavras[idx] = pt
musica.append(" ".join(lista_palavras))

for linha in musica:
stdout.write(linha+'\n')
stdout.write("\n")

0 comments on commit a158694

Please sign in to comment.