-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
submetendo as resoluções dos exercícios da XVII maratona de programaç…
…ão santo scuderi
- Loading branch information
Showing
4 changed files
with
78 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |