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 1307. Archiver

To admins: Why WA#1?Help Please
Posted by RASTA 22 Mar 2009 18:16
size of my archive is larger than text or something else?
Help Please!
Re: To admins: Why WA#1?Help Please
Posted by RASTA 22 Mar 2009 19:26
my source:
var
  s: ansistring;
  x: char;
Begin
  while not eof do begin
    read(x);
    if x = #13 then s := s + '#';
    if (x = #10) or (x = #13) then continue;
    s := s + x;
  end;
  x := chr(39);
  writeln('//CPP');
  writeln('#include<iostream.h>');
  writeln('int main()');
  writeln('{char s[',length(s),']="', s, '";');
  write('for(int i=0;i<',length(s),';i++)if(s[i]==',x,'#',x,')cout<<"\n";else cout<<s[i];return 0;}');
End.

solution with stdio.h doesn't work too

var
  s: ansistring;
  x: char;
Begin
  while not eof do begin
    read(x);
    if x = #13 then s := s + '#';
    if (x = #10) or (x = #13) then continue;
    s := s + x;
  end;
  x := chr(39);
  writeln('//CPP');
  writeln('#include<stdio.h>');
  writeln('int main()');
  writeln('{char s[',length(s),']="', s, '";');
  write('for(int i=0;i<',length(s),';i++)if(s[i]==',x,'#',x,')printf("\n");else printf("%s",s[i]);return 0;}');
End.
Re: To admins: Why WA#1?Help Please
Posted by Programmer 22 Mar 2009 21:08
RASTA wrote 22 March 2009 18:16
size of my archive is larger than text or something else?
Help Please!

Yes
Re: To admins: Why WA#1?Help Please
Posted by RASTA 22 Mar 2009 22:38
I can't believe in it...
in the first test more than 200 lines with characters #13 and #10...
in my program only 130 additional symbols and more than 70 symbols I have in reserve
Am I right?

Edited by author 22.03.2009 22:46

Edited by author 22.03.2009 22:52
Re: To admins: Why WA#1?Help Please
Posted by Programmer 22 Mar 2009 23:29
The size of your programm is the size of your output. Pay attention. Read clearly statement.
Re: To admins: Why WA#1?Help Please
Posted by RASTA 23 Mar 2009 00:14
I know this or I don't understand you...
archive for test is
//CPP
#include<iostream.h>
int main()
{char s[!!!length of input!!!]="text from input with # instead of eofs";
for(int i=0;i<!!!length of input!!!;i++)if(s[i]=='#')cout<<"\n";else cout<<s[i];return 0;}

so size of archive(output of my program) equal the size of input - count of eofs + integer from 130 to 140
it less than length of input
where I'm wrong?may be statement in russian have some bugs?