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 1821. Biathlon

Help PLEASE, i don't understand
Posted by green_smile 9 Oct 2012 23:25
input
6
Zaitseva 21:38.2
Hauswald 21:21.0
Boulygina 22:04.4
Henkel 22:06.1
Wilhelm 21:11.1
Jonsson 22:05.8
My program:
4
Hauswald
Henkel
Wilhelm
Zaitseva


explain me please what's wrong???
why Henkel isn't in Test?
Re: Help PLEASE, i don't understand
Posted by green_smile 9 Oct 2012 23:27
it's code

program z1821;
var n,i,j,m,x,max,ol:integer;
s,s1:string;
names:array[1..100]of string;
times:array[1..100]of integer;
reznames:array[1..100] of string;

begin
readln(n);
j:=1;
for i:=1 to n do begin
    readln (s);
    while s[j]<>' ' do  begin
    inc(j);
    end;
    names[i]:=copy(s,1,j);    //
    delete(s1,1,length(s1));  //
    s1:=copy(s,j+1,2);        //
    val(s1,times[i],ol);      //
    delete(s1,1,2);           //
    s1:=copy(s,j+4,2);        //
    times[i]:=times[i]*600;   //
    val(s1,x,ol);             //
    times[i]:=times[i]+x*10;  //
    delete(s1,1,1);           //
    s1:=copy(s,j+7,1);        //
    val(s1,x,ol);             //
    times[i]:=times[i]+x;     //
    j:=1;                     //it's input, don't look on it =)
end;
    for i:=2 to n do
    times[i]:=times[i]-300*(i-1);
    max:=times[1]+1;
    m:=0;
  j:=1;
    for i:=1 to n do begin
        if times[i]<max then begin
            max:=times[i];
            reznames[j]:=names[i];
            m:=m+1;
      j:=j+1;
        end;
    end;

        for i := 1 to m-1 do
        for j := 1 to m-i do
            if reznames[j] > reznames[j+1] then begin
                s1 := copy(reznames[j],1,length(reznames[j]));
                reznames[j] :=copy(reznames[j+1],1,length(reznames[j+1]));
                reznames[j+1] :=copy(s1,1,length(s1));
            end;
 writeln(m);
    for i := 1 to m do
        writeln(reznames[i]);
end.

Edited by author 09.10.2012 23:47