ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1964. Chinese Dialects

WA #7 What is the problem? Pascal
Posted by Mosca Felice 3 Jan 2015 03:25
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
Posted by Oleksandr Ushkalenko 27 Jan 2015 23:29
Algorithm mistake, example:
2 3
2 2 2
Your answer is 4, but should be 2.

Edited by author 27.01.2015 23:29