WA #7 What is the problem? Pascal
var a: int64;
n:int64; sum:int64; i,k:integer;
begin
read(n,k);
a:=0;
sum:=0;
for i:=1 to k do begin read(a); sum:=sum+a; end;
if sum-n >=0 then
write(sum - n) else write('0');
end.
Edited by author 03.01.2015 03:26
Edited by author 03.01.2015 03:27
Re: WA #7 What is the problem? Pascal
Algorithm mistake, example:
2 3
2 2 2
Your answer is 4, but should be 2.
Edited by author 27.01.2015 23:29