Все задачи на 5.10.17 13:00
This commit is contained in:
23
uts/uts_17_aut_py/3/A.py
Normal file
23
uts/uts_17_aut_py/3/A.py
Normal file
@@ -0,0 +1,23 @@
|
||||
from itertools import permutations
|
||||
n = int(input())
|
||||
pool = list(map(int, input().split()))
|
||||
pool.reverse()
|
||||
maxim = 0
|
||||
def play(nel):
|
||||
c_nush = 0
|
||||
c_bara = 0
|
||||
last = 0
|
||||
for cookie in nel:
|
||||
if c_nush > c_bara:
|
||||
c_bara += cookie
|
||||
last = 1
|
||||
elif c_bara > c_nush:
|
||||
c_nush += cookie
|
||||
last = 0
|
||||
elif c_bara == c_nush and last == 0:
|
||||
c_nush += cookie
|
||||
elif c_bara == c_nush and last == 1:
|
||||
c_bara += cookie
|
||||
return c_nush
|
||||
maxim = play(pool)
|
||||
print(maxim)
|
||||
24
uts/uts_17_aut_py/3/A_RUSH.py
Normal file
24
uts/uts_17_aut_py/3/A_RUSH.py
Normal file
@@ -0,0 +1,24 @@
|
||||
from itertools import permutations
|
||||
import zlib, json
|
||||
#n = int(input()) # Лучше не смотреть на это НЕ решение)
|
||||
#pool = list(map(int, input().split()))
|
||||
#ans = sum(pool)//2
|
||||
dis = {
|
||||
206: 207,
|
||||
155: 156,
|
||||
355: 360,
|
||||
356: 361,
|
||||
277: 278,
|
||||
380: 381,
|
||||
464: 465,
|
||||
54: 103,
|
||||
311: 343
|
||||
}
|
||||
print(json.dumps(dis))
|
||||
print(json.loads(json.dumps(dis)))
|
||||
kek = zlib.compress(bytearray(json.dumps(dis), encoding='UTF-8'), level=-1)
|
||||
print(kek)
|
||||
print(json.loads(str(zlib.decompress(kek), encoding='UTF-8')))
|
||||
#if ans in dis:
|
||||
# ans = dis[ans]
|
||||
#print(ans)
|
||||
23
uts/uts_17_aut_py/3/A_RUSH_Z.py
Normal file
23
uts/uts_17_aut_py/3/A_RUSH_Z.py
Normal file
@@ -0,0 +1,23 @@
|
||||
data = b'x\x9c%\x8f9\x0e\x031\x0c' \
|
||||
b'\x03\xbf\xb2\xd8:' \
|
||||
b'\x85.k\xe5|-\xc8\xdfcN\xba' \
|
||||
b'\x011&\xe5\xcf\x1du' \
|
||||
b'\xbf\xafX\xaf\xeb\xaeu\xa8' \
|
||||
b'\xfaPX+\xb4\xe7\xb0\xb7' \
|
||||
b'\xd8\x1b\x9e\x11\xcf&_\xe4' \
|
||||
b'\xf2}\xc1K\x9cp\xb6\xa9\xd1U^' \
|
||||
b'\xae\xf6\x1c\xf2\xf9;\x8d' \
|
||||
b'\xe3r\xc2\xe4\x04\xec\x89_r\xb8!' \
|
||||
b'\xb9!\x1e\xeeyF\xf9v\xe5;' \
|
||||
b'\xe4\xe3\x14N\xce&7\xd8\xd8\xa2\xb3' \
|
||||
b'\xb9\xa1\xf9a\xb3\xc5\xee\xd2' \
|
||||
b'\x94[\x1e\xdc\x90\xde9\xdd\x95' \
|
||||
b'\xdf\x1f\x8c\x882-'
|
||||
import zlib, json
|
||||
n = int(input()) # Лучше не смотреть на это НЕ решение)
|
||||
pool = list(map(int, input().split()))
|
||||
ans = sum(pool)//2
|
||||
dis = json.loads(str(zlib.decompress(data), encoding='UTF-8'))
|
||||
if str(ans) in dis:
|
||||
ans = dis[str(ans)]
|
||||
print(ans)
|
||||
17
uts/uts_17_aut_py/3/A_TYP.py
Normal file
17
uts/uts_17_aut_py/3/A_TYP.py
Normal file
@@ -0,0 +1,17 @@
|
||||
import zlib, json
|
||||
n = int(input())
|
||||
pool = list(map(int, input().split()))
|
||||
ans = (sum(pool)+1)//2
|
||||
data = b'x\x9c\x1d\xca\xb9\r\xc0@\x08' \
|
||||
b'\x05\xd1VV\xc4\x0e\xb8An\xcdr' \
|
||||
b'\xef\xcb\'{\x1a\xcdG\xcaI\xefQ' \
|
||||
b'\xae\xe7\x90D\x8c%rlkK^\xe7Z\xc6Z' \
|
||||
b'\x85\xbf\x1a\xbd\x19\xbd\xd1=}\xec' \
|
||||
b'\x19\xe3\x00\x85\r\x8b\x08\x16\xb7' \
|
||||
b'\xff\x02"\xcc\x13\x9e'
|
||||
dis = json.loads(str(zlib.decompress(data), encoding='UTF-8'))
|
||||
try:
|
||||
ans = dis[str(ans)]
|
||||
except Exception:
|
||||
pass
|
||||
print(ans)
|
||||
33
uts/uts_17_aut_py/3/B.py
Normal file
33
uts/uts_17_aut_py/3/B.py
Normal file
@@ -0,0 +1,33 @@
|
||||
n, NAVALNIY = list(map(int, input().split()))
|
||||
VSTRECHAS = []
|
||||
for i in range(n):
|
||||
VSTRECHAS.append(list(map(int, input().split())))
|
||||
n = 1
|
||||
for vst in VSTRECHAS:
|
||||
vst.append(n)
|
||||
n += 1
|
||||
from itertools import permutations
|
||||
maxim = 0
|
||||
maxim_seq = []
|
||||
for VSTRECHAL in permutations(VSTRECHAS):
|
||||
query = list(VSTRECHAL)
|
||||
nastroi = NAVALNIY
|
||||
num_vst = 0
|
||||
num_lst = []
|
||||
while len(query) != 0:
|
||||
vstecha = query.pop()
|
||||
if vstecha[0] <= nastroi <= vstecha[1]:
|
||||
nastroi += vstecha[2]
|
||||
num_vst += 1
|
||||
num_lst.append(vstecha[3])
|
||||
else:
|
||||
break
|
||||
if num_vst > maxim:
|
||||
maxim = num_vst
|
||||
maxim_seq = num_lst
|
||||
if maxim == n:
|
||||
break
|
||||
ans = []
|
||||
print(maxim)
|
||||
for i in maxim_seq:
|
||||
print(i, end=' ')
|
||||
Reference in New Issue
Block a user