Created
February 13, 2020 13:35
-
-
Save wheeliechamp/f079721552d4b68ca956ce9bbdaa5482 to your computer and use it in GitHub Desktop.
Python
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
# ダメなコード | |
datas = [] | |
info = list(map(int, input().split(' '))) | |
for i in range(info[0]): | |
tmp = input().rstrip().split(' ') | |
datas.append(tmp) | |
result_ary = [] | |
result_ary.append([0, info[1]]) | |
for i in range(info[0]): | |
for j in range(len(result_ary)): | |
if result_ary[j][0] == i: | |
result_ary.append([i+1, result_ary[j][1] - int(datas[i][0])]) | |
if result_ary[j][1] + int(datas[i][1]) > info[2]: | |
result_ary.append([i+1, 99999999]) | |
else: | |
result_ary.append([i+1, result_ary[j][1] + int(datas[i][1])]) | |
count = 0 | |
for i in range(len(result_ary)): | |
if result_ary[i][0] == info[0]: | |
if result_ary[i][1] <= info[2] and result_ary[i][1] > 0: | |
pass | |
#print(result_ary[i]) | |
count += 1 | |
print(count) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment