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
8 symbols golfscript
Sun Apr 22 10:24:46 2018 drafear
~]{-)}*(
9 symbols golfscript
Sun Apr 22 10:06:47 2018 drafear
[~]{-)}*(
20 symbols golfscript
Sun Apr 22 10:34:30 2018 drafear
~]:a 2>~a 2<~\{\-}@*
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()))
59 symbols haskell
Tue Sep 18 06:37:55 2018 YoshikuniJujo
main=interact$show.(\(a:_:b)->read a-sum(map read b)).lines
76 symbols python3
Wed Jan 23 03:45:27 2019 eddvrs
o,c=input(),input();print(int(o)-sum([int(input()) for x in range(int(c))]))
83 symbols python3
Tue Mar 19 09:10:11 2019 fidget123
a = int(input())
n = int(input())
for i in range(n):
    a -= int(input())
print(a)

View all solutions