SHOPPING! SHOPPING! SHOPPING!

input :
First line = Your money
Second line = n = Many items you buy
Third line - n line = price of items

Output : the rest of the money you have

IN

2000
2
1000
100

OUT

900

IN

3000
2
1000
1000

OUT

1000

IN

20000
5
2000
3000
1000
1000
1000

OUT

12000

IN

20000
3
2000
1000
1000

OUT

16000

IN

10000
2
1000
1000

OUT

8000
Login to submit solution


6 symbols pyth
Sat Nov 5 17:28:25 2016 Sait2000
-Qst.Q
38 symbols python2
Sun Dec 11 15:22:27 2016 Sait2000
_=input
print _()-sum(map(_,['']*_()))
41 symbols python2
Sun Dec 11 15:19:17 2016 Sait2000
_=input
print _()-sum(_()for _ in[_]*_())
45 symbols python2
Sat Dec 10 01:16:01 2016 tylus
print input()-sum(input()for _ in[0]*input())
49 symbols python2
Sat Dec 10 01:14:22 2016 tylus
print input()-sum(input()for i in range(input()))

View all solutions