Explorar el Código

Merge in practice data (use git subtree merge to update)

master
Yorick van Pelt hace 2 años
padre
commit
0dca41fffb
Se han modificado 4 ficheros con 53 adiciones y 0 borrados
  1. 3
    0
      practice/A.py
  2. 6
    0
      practice/A_.py
  3. 39
    0
      practice/B.py
  4. 5
    0
      practice/C.py

+ 3
- 0
practice/A.py Ver fichero

@@ -0,0 +1,3 @@
import sys
N = int(sys.stdin.readline())
print(N**0.5*4)

+ 6
- 0
practice/A_.py Ver fichero

@@ -0,0 +1,6 @@
import sys
N = int(sys.stdin.readline())
if "PyPy" in sys.version:
print(N**0.5*4)
else:
raise RuntimeError("WTF")

+ 39
- 0
practice/B.py Ver fichero

@@ -0,0 +1,39 @@
from __future__ import print_function
import sys

s, e = map(int, sys.stdin.readline().split())
es = map(int, sys.stdin)

OK = [ [0]*(s+1) for i in xrange(e+1) ]
OK[0][0] = 1

for i in xrange(e):
for j in xrange(s+1):
if OK[i][j]: OK[i+1][j] = 1
if es[i] > j: continue
if OK[i][j-es[i]]: OK[i+1][j] = 2

ns = []; i, j = e, s
while i > 0 and j >= 0:
x = OK[i][j]
if x == 2:
ns.append(i-1)
i -= 1
j -= es[i]
else:
i -= 1

# print(ns)
# import pprint; pprint.pprint(OK)

print(e+1)
k, l = 1, 3
for n in ns[:-1]:
print(k, l, es[n])
k = l; l += 1
print(k, 2, es[ns[-1]])
ns = set(ns); k = 2
for i,j in enumerate(es):
if i not in ns:
print(k, l, j)
k = l; l += 1

+ 5
- 0
practice/C.py Ver fichero

@@ -0,0 +1,5 @@
from __future__ import print_function
import sys
P = sys.stdin.readline().rstrip()
N = 26-len(set(P))
print(N if N != 0 else "impossible")

Cargando…
Cancelar
Guardar