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

Why WA#3??? {Почему WA#3???}
var i, j, k, t: word;
    a: array [1 .. 101] of word;
    s: word;
begin
     read(k);
     if k = 0 then
        s := 0
     else begin
          for i := 1 to k do
              read(a[i]);
          for i := 1 to k - 1 do
              for j := 1 to k - i do
                  if a[j] > a[j + 1] then begin
                     t := a[j];
                     a[j] := a[j + 1];
                     a[j + 1] := t;
                  end;
          s := 0;
          for i := 1 to k div 2 + 1 do
              s := s + a[j] div 2 + 1;
     end;
     writeln(s);
end.
Re: Why WA#3??? {Почему WA#3???}
Here is my program! IT works.
const kmax = 101;
var n, n2, k, t, i, j: longint;
a: array[1..kmax] of longint;
begin
read(k);
for i := 1 to k do
read(a[i]);
for i := 1 to k - 1 do
for j := 1 to k - i do
if a[j] > a[j + 1] then begin
t := a[j];
a[j] := a[j + 1];
a[j + 1] := t;
end;
n := 0;
for i := 1 to k div 2 + 1 do
inc(n, a[i] div 2 + 1);
write(n);
end.