Skip to content

Commit bb7f566

Browse files
committed
13/06/2019
1 parent b38e5d0 commit bb7f566

27 files changed

+522
-2
lines changed

.vscode/launch.json

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Python: Current File (Integrated Terminal)",
9+
"type": "python",
10+
"request": "launch",
11+
"program": "${file}",
12+
"console": "integratedTerminal"
13+
},
14+
{
15+
"name": "Python: Remote Attach",
16+
"type": "python",
17+
"request": "attach",
18+
"port": 5678,
19+
"host": "localhost",
20+
"pathMappings": [
21+
{
22+
"localRoot": "${workspaceFolder}",
23+
"remoteRoot": "."
24+
}
25+
]
26+
},
27+
{
28+
"name": "Python: Module",
29+
"type": "python",
30+
"request": "launch",
31+
"module": "enter-your-module-name-here",
32+
"console": "integratedTerminal"
33+
},
34+
{
35+
"name": "Python: Django",
36+
"type": "python",
37+
"request": "launch",
38+
"program": "${workspaceFolder}/manage.py",
39+
"console": "integratedTerminal",
40+
"args": [
41+
"runserver",
42+
"--noreload",
43+
"--nothreading"
44+
],
45+
"django": true
46+
},
47+
{
48+
"name": "Python: Flask",
49+
"type": "python",
50+
"request": "launch",
51+
"module": "flask",
52+
"env": {
53+
"FLASK_APP": "app.py"
54+
},
55+
"args": [
56+
"run",
57+
"--no-debugger",
58+
"--no-reload"
59+
],
60+
"jinja": true
61+
},
62+
{
63+
"name": "Python: Current File (External Terminal)",
64+
"type": "python",
65+
"request": "launch",
66+
"program": "${file}",
67+
"console": "externalTerminal"
68+
}
69+
]
70+
}

.vscode/settings.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"python.pythonPath": "/usr/bin/python"
3+
}

1001.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import math
2+
13
a = input()
24
b = input()
35

1222.py

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
while True:
2+
try:
3+
nPalavras, nLinhasMax, nCaractMax = raw_input().split(' ')
4+
nLinhasMax = int(nLinhasMax)
5+
nCaractMax = int(nCaractMax)
6+
7+
texto = raw_input()
8+
textoPalavras = texto.split(' ')
9+
10+
nLinhas = 0
11+
nCaracteres = 0
12+
index = 0
13+
14+
for palavra in textoPalavras:
15+
palavraTamanho = len(palavra)
16+
17+
if palavraTamanho + nCaracteres > nCaractMax:
18+
nLinhas += 1
19+
nCaracteres = palavraTamanho
20+
else:
21+
nCaracteres += palavraTamanho
22+
23+
if index != len(textoPalavras) - 1:
24+
if nCaracteres + 1 < nCaractMax:
25+
nCaracteres += 1
26+
else:
27+
nLinhas += 1
28+
nCaracteres = 0
29+
30+
index += 1
31+
32+
print int(nLinhas/nLinhasMax) + 1
33+
except EOFError:
34+
break

1235.py

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
n = input()
2+
3+
for nIndex in range(n):
4+
texto = raw_input()
5+
textoMetade = len(texto)/2
6+
7+
novoTexto = ""
8+
9+
for textoIndex in range(len(texto)):
10+
novoTexto += texto[textoMetade -1 - textoIndex]
11+
12+
print novoTexto

1238.py

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
n = input()
2+
3+
for nIndex in range(n):
4+
texto = raw_input()
5+
palavras = texto.split(' ')
6+
novoTexto = ""
7+
8+
index = 0
9+
stopped = False
10+
11+
while index <= len(palavras[0]) - 1 or index <= len(palavras[1]) - 1:
12+
if index <= len(palavras[0]) - 1:
13+
novoTexto += palavras[0][index]
14+
if index <= len(palavras[1]) - 1:
15+
novoTexto += palavras[1][index]
16+
17+
index += 1
18+
19+
print novoTexto

1239.py

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
while True:
2+
try:
3+
texto = raw_input()
4+
openedItalico = False
5+
openedBold = False
6+
novoTexto = ""
7+
8+
for letra in texto:
9+
if letra == '_':
10+
if openedItalico:
11+
letra = '</i>'
12+
openedItalico = False
13+
else:
14+
letra = '<i>'
15+
openedItalico = True
16+
17+
if letra == '*':
18+
if openedBold:
19+
letra = '</b>'
20+
openedBold = False
21+
else:
22+
letra = '<b>'
23+
openedBold = True
24+
25+
novoTexto += letra
26+
27+
print novoTexto
28+
except EOFError:
29+
break

1241.py

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
n = input()
2+
3+
for nIndex in range(n):
4+
n1, n2 = raw_input().split(' ')
5+
6+
if n1[len(n1) - len(n2) : len(n1)] == n2:
7+
print "encaixa"
8+
else:
9+
print "nao encaixa"

1243.py

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
letras = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '.']
2+
3+
while True:
4+
try:
5+
texto = raw_input()
6+
palavras = texto.split(' ')
7+
nPalavras = 0
8+
nTamanhoPalavras = 0
9+
10+
for palavra in palavras:
11+
ePalavra = True
12+
nPontos = 0
13+
14+
for caracter in palavra:
15+
try:
16+
letras.index(caracter)
17+
if caracter == '.':
18+
if nPontos >= 1:
19+
ePalavra = False
20+
break
21+
else:
22+
nPontos += 1
23+
except:
24+
ePalavra = False
25+
break
26+
27+
if ePalavra:
28+
nPalavras += 1
29+
nTamanhoPalavras += len(palavra.replace('.', ''))
30+
31+
medioTamanhoPalavras = 0
32+
33+
if nPalavras != 0:
34+
medioTamanhoPalavras = int(nTamanhoPalavras / nPalavras)
35+
36+
if medioTamanhoPalavras <= 3:
37+
print "250"
38+
elif medioTamanhoPalavras == 4 or medioTamanhoPalavras == 5:
39+
print "500"
40+
else:
41+
print "1000"
42+
except EOFError:
43+
break

1248.py

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
n = input()
2+
3+
for nIndex in range(n):
4+
alimentos = raw_input()
5+
alimentosManha = raw_input()
6+
alimentosAlmoco = raw_input()
7+
8+
cheat = False
9+
alimentosRestantes = []
10+
11+
for alimento in alimentos:
12+
alimentosRestantes.insert(len(alimentosRestantes), alimento)
13+
14+
for alimentoManha in alimentosManha:
15+
try:
16+
alimentosRestantes.remove(alimentoManha)
17+
except ValueError:
18+
cheat = True
19+
20+
for alimentoAlmoco in alimentosAlmoco:
21+
try:
22+
alimentosRestantes.remove(alimentoAlmoco)
23+
except ValueError:
24+
cheat = True
25+
26+
if cheat:
27+
print "CHEATER"
28+
continue
29+
30+
alimentosRestantes = sorted(alimentosRestantes)
31+
texto = ""
32+
33+
for alimentoRestante in alimentosRestantes:
34+
texto += alimentoRestante
35+
36+
print texto

1249.py

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
letras = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
2+
3+
while True:
4+
try:
5+
texto = raw_input()
6+
novoTexto = ""
7+
8+
for letra in texto:
9+
novaLetra = letra.lower()
10+
try:
11+
letraIndex = letras.index(novaLetra)
12+
if letraIndex + 1 <= 13:
13+
if letra.islower():
14+
novoTexto += letras[letraIndex + 13]
15+
else:
16+
novoTexto += letras[letraIndex + 13].upper()
17+
else:
18+
if letra.islower():
19+
novoTexto += letras[letraIndex - 13]
20+
else:
21+
novoTexto += letras[letraIndex - 13].upper()
22+
except ValueError:
23+
novoTexto += letra
24+
25+
print novoTexto
26+
except EOFError:
27+
break

1253.py

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
letras = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
2+
3+
n = input()
4+
5+
for nIndex in range(n):
6+
texto = raw_input()
7+
novoTexto = ""
8+
nEsquerda = input()
9+
10+
for letra in texto:
11+
novoTexto += letras[letras.index(letra) - nEsquerda]
12+
13+
print novoTexto

1255.py

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
letras = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
2+
3+
n = input()
4+
5+
for nIndex in range(n):
6+
letrasValores = []
7+
valores = []
8+
texto = raw_input().lower()
9+
maior = 1
10+
11+
for caractere in texto:
12+
try:
13+
index = letras.index(caractere)
14+
try:
15+
letrasValoresIndex = letrasValores.index(caractere)
16+
valores[letrasValoresIndex] += 1
17+
if valores[letrasValoresIndex] > maior:
18+
maior = valores[letrasValoresIndex]
19+
except ValueError:
20+
letrasValores.insert(len(letrasValores), caractere)
21+
valores.insert(len(valores), 1)
22+
except ValueError:
23+
continue
24+
25+
maioresLetras = []
26+
27+
for mIndex in range(len(valores)):
28+
if valores[mIndex] == maior:
29+
maioresLetras.insert(len(maioresLetras), letrasValores[mIndex])
30+
31+
maioresLetras = sorted(maioresLetras)
32+
texto = ""
33+
34+
for maiorLetra in maioresLetras:
35+
texto += maiorLetra
36+
37+
print texto

1257.py

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
alfabeto = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
2+
n = input()
3+
4+
for nIndex in range(n):
5+
nLinhas = input()
6+
soma = 0
7+
8+
for nLinhasIndex in range(nLinhas):
9+
texto = raw_input()
10+
caractereIndex = 0
11+
12+
for caractere in texto:
13+
soma += alfabeto.index(caractere) + nLinhasIndex + caractereIndex
14+
caractereIndex += 1
15+
16+
print soma

0 commit comments

Comments
 (0)