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

wa2 why?
Posted by Pk.95 25 Dec 2010 00:13
program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils;
var
k,i,j,min:byte;
t:Word;
nas:array of Word;
begin
read(k);
if k = 1 then
begin
read(t);
write((t+1)div 2);
exit;
end;
SetLength(nas,k+1);
for i:=1 to k do
read(nas[i]);
for i:=1 to k-1 do
begin
min:=i;
for j:=i+1 to k do
if nas[j] < nas[min] then
min:=j;
t:=nas[i];
nas[i]:=nas[min];
nas[min]:=t;
end;
write((nas[1]+1) div 2 + (nas[2]+1)div 2);

end.