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 1991. The battle near the swamp

what mistake?
Posted by Evgenii 13 Jun 2017 12:36
program pr;
     Var
     n,k,i,s,q:integer;
     a:array[1..100000] of integer;
     b:array[1..100000] of integer;
Begin
     q:=0;
     read(n,k);
     for i:=1 to n do
     readln(a[i]);
     for i:=1 to n do
     b[i]:=k-a[i];
     for i:=1 to n do begin
     if b[i]<0 then s:=abs(b[i]);
     if b[i]>=0 then q:=q+b[i] ;
     end;

write(s,' ',q)
End.
Re: what mistake?
Posted by ToadMonster 13 Jun 2017 18:03
Have you tried to run program locally, on example? It doesn't work.
http://ideone.com/0zSolR