ENG  RUSTimus Online Judge
Online Judge
Задачи
Авторы
Соревнования
О системе
Часто задаваемые вопросы
Новости сайта
Форум
Ссылки
Архив задач
Отправить на проверку
Состояние проверки
Руководство
Регистрация
Исправить данные
Рейтинг авторов
Текущее соревнование
Расписание
Прошедшие соревнования
Правила
вернуться в форум

Обсуждение задачи 1307. Архиватор

To admins: Why WA#1?Help Please
Послано RASTA 22 мар 2009 18:16
size of my archive is larger than text or something else?
Help Please!
Re: To admins: Why WA#1?Help Please
Послано RASTA 22 мар 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
Послано Programmer 22 мар 2009 21:08
RASTA писал(a) 22 марта 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
Послано RASTA 22 мар 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
Послано Programmer 22 мар 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
Послано RASTA 23 мар 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?