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

Common Board

Who solved 1050 ? Please help me.
Posted by HNT 9 Jun 2001 13:01
What is a blank line ?
???
Here is my solution (read from input.txt and write to
output.txt). Please give me some sample input, output.
Thank.

{$R+}
Program Preparing_an_article;
Const
     fi = 'input.txt';
     fo = 'output.txt';
     characters = ['A'..'Z','a'..'z'];
Label rep;
Var
     f1,f2  : text;
     quotes : word;
     wrote  : boolean;
     par    : array[0..20250] of char;
     l,i,t  : word;
     s      : string;

Begin
  assign(f1,fi); reset(f1);
  assign(f2,fo); rewrite(f2);
  wrote := true;
  par[0]:=' ';
  repeat

      if wrote then
        begin l := 0; quotes := 0; end;

      repeat
        inc(l);
        read(f1,par[l]);
        if par[l]='"' then
          inc(quotes);
      until (par[l]='\')or((par[l]=#10)and(par[l-1]=#13));

      if par[l]='\' then
      begin
        s := '';
        while (not eof(f1)) do
        begin
          inc(l); read(f1,par[l]);
          if par[l] in characters then s := s + par[l]
          else break;
        end;

        if (s='')and(par[l]='"') then
          begin  wrote := false; continue;end;
        if s = 'endinput' then
          while not eof(f1) do begin inc(l);read(f1,par
[l]);end;
      end;


      if ((par[l]=#10)and(par[l-1]=#13) )
      or(s = 'par') or (s = 'endinput') then
        begin
          t := 1;
          for i := 1 to l do
            begin
              if (par[i-1]<>'\')and(par[i] = '"')
                 and((t
'"')or
              ((par[i]='"')and(par[i-1]='\'))
               then write(f2,par[i]);
            end;
          wrote := true;
        end else wrote := false;
  until s='endinput';

  close(f1); close(f2);
End.
Re: Who solved 1050 ? Please help me.
Posted by Stefan Pochmann 9 Jun 2001 17:05
I haven't solved this one yet, but in real latex, a
"blank line" can contain whitespace (space, tab) and
still be a paragraph-separator. It doesn't have to be
an "empty line".

Hope that helps...
Btw, is the sample io totally bullshit or what?

Stefan
Re: Who solved 1050 ? Please help me.
Posted by HNT 9 Jun 2001 19:22
Thank you . I've just got AC.
Thanx.

> I haven't solved this one yet, but in real latex, a
> "blank line" can contain whitespace (space, tab) and
> still be a paragraph-separator. It doesn't have to be
> an "empty line".
>
> Hope that helps...
> Btw, is the sample io totally bullshit or what?
>
> Stefan
>