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 1025. Democracy in Danger

Test 5. what's wrong?? please help!!
Posted by Kirik 22 Feb 2012 16:58
program f;
var x,m,i,amount,s,j,g,k:integer;
a: array [1..10000] of integer;



begin
read (m);
for i:=1 to m do
read (a[i]);


for i:=1 to m do
begin
for j:=1 to m-1 do
for g:=1 to m-j do

if a[i]>a[i+1] then
begin
k:=a[i];
a[i]:=a[i+1];
a[i+1]:=k;
end;
end;

amount:=(m div 2) +1;


for i:=1 to amount do
s:=s+(a[i]div 2)+1;



write (s);
end.
Re: Test 5. what's wrong?? please help!!
Posted by tmp 12 Mar 2012 22:56
Incorrect sort algorithm. Variable 's' not initialized.