Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def download():
- with open('input.txt') as inf:
- num, summa = map(int, inf.readline().split())
- array = []
- for i in range(num):
- array.append(inf.readline().rstrip())
- return summa, array
- def date(array):
- new=[]
- for i in array:
- a,b = (i.split())
- new.append(int(a))
- new.append(int(b))
- return new
- def result(summa, array):
- n=len(array)
- for i in range(0,n,2):
- check = 0
- for j in range(array[i+1]):
- check += array[i]
- if check==summa:
- return 'possible'
- return 'impossible'
- def save(string):
- with open('output.txt','w') as outf:
- print(string,file=outf)
- if __name__ == '__main__':
- print(download()[0])
- print(date(download()[1]))
- print(result(download()[0],date(download()[1])))
- save(result(download()[0],date(download()[1])))
Add Comment
Please, Sign In to add comment