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 1313. Some Words about Sport

Wrong Answer
Posted by Anh Ba Hung 4 Feb 2005 16:19
var
    n,i,j,so,dong,cot : longint;
    a : array[1..100,1..100] of longint;
    b : array[1..100] of longint;
begin
    readln(n);
    for i:=1 to n do
    begin
        for j:=1 to n do
            read(a[i,j]);
        readln;
    end;
    so := 0;
    cot := 1;
    dong := 1;
    repeat
        i := dong;
        j := cot;
        repeat
            so := so + 1;
            b[so] := a[i,j];
            i := i - 1;
            j := j + 1;
        until ((j>n) or (i=0));
        cot := 1;
        dong := dong + 1;
    until (dong>n);
    cot := 2;
    dong := n;
    repeat
        i := dong;
        j := cot;
        repeat
            so := so + 1;
            b[so] := a[i,j];
            i := i - 1;
            j := j + 1;
        until ((j>n) or (i=0));
        dong := n;
        cot := cot + 1;
    until (cot>n);
    for i:=1 to so do
    begin
        write(b[i],' ');
    end;
end.

I couldn't understand why it is incorrect ? :(
Oh my godness :) ! (+)
Posted by Dmitry 'Diman_YES' Kovalioff 4 Feb 2005 23:16
Try the following test:

1
1

Your program's output is '1 0', but the correct one is obviously '1'.

P.S. Your code is unforgettable :)
Re: Oh my godness :) ! (+)
Posted by Anh Ba Hung 5 Feb 2005 13:20
Thanks :)

>> P.S. Your code is unforgettable :)

Why ? :)