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

Обсуждение задачи 1007. Кодовые слова

HELP !!! My program is WA, but I think this's RIGHT !!!
Послано Dim 31 мар 2003 20:24
This is my SOLUTION.
-----------------------------------------------------------------------------
var           S, Sr1, sr2: string;
               i, i1, l, N, sum, sl, code, W: integer;
Procedure One_summ1(var sum:integer);
  Begin    Sum:=0;
  For l:=1 to length(sr1) do
    begin
          val(sr1[l],sl,code);
          Sum:=sum+l*Sl;     end;   end;

Begin
  Readln(N);
  Repeat
    Readln(S);
    Val(S,W,code);
    If W=0 then begin
                      for i:=1 to Length(S) do Write('0');
                      continue;
                      end;
    If Length(s)=N+1 then
         begin
         For i1:=1 to length(S) do
           begin
           sr1:=s;
           Delete(sr1,i1,1);
           One_summ1(sum);
             If ((sum)mod(n+1)=0) then
               begin
               Writeln(Sr1);
               Break;     end;   end;    end;

      If Length(s)=N then
         begin
         For i1:=1 to length(S) do
           begin
           sr1:=s;
           If sr1[i1]='1' then sr1[i1]:='0'
                          else continue;
           One_summ1(sum);
             If ((sum)mod(n+1)=0) then
               begin
               Writeln(Sr1);
               Break;     end;    end;    end;

      If Length(s)=N-1 then
        Begin
        For i1:=1 to length(S)+1 do
          begin
          sr1:=s;     sr2:=s;
          Insert('1',sr1,i1); Insert('0',sr2,i1);
          One_summ1(sum);
             If ((sum)mod(n+1)=0) then
             begin
               Writeln(Sr1);
               Break;
             end;
          sr1:=sr2;
          One_summ1(sum);
             If ((sum)mod(n+1)=0) then
             begin
               Writeln(Sr1);
               Break;
               end;       end;      end;
    until seekEOF;
End.
----------------------------------------------------------------------------------------
Maybe then output is INCORRECT.
              PLEASE, HELP ME OR WRITE SOME TEST!
                                Thank you.
Re: HELP !!! My program is WA, but I think this's RIGHT !!!
Послано Egroman 1 апр 2003 17:59
> This is my SOLUTION.
>
----------------------------------------------------------------------
-------
> var           S, Sr1, sr2: string;
>                i, i1, l, N, sum, sl, code, W: integer;
> Procedure One_summ1(var sum:integer);
>   Begin    Sum:=0;
>   For l:=1 to length(sr1) do
>     begin
>           val(sr1[l],sl,code);
>           Sum:=sum+l*Sl;     end;   end;
>
> Begin
>   Readln(N);
>   Repeat
>     Readln(S);
>     Val(S,W,code);
>     If W=0 then begin
>                       for i:=1 to Length(S) do Write('0');
>                       continue;
>                       end;
>     If Length(s)=N+1 then
>          begin
>          For i1:=1 to length(S) do
>            begin
>            sr1:=s;
>            Delete(sr1,i1,1);
>            One_summ1(sum);
>              If ((sum)mod(n+1)=0) then
>                begin
>                Writeln(Sr1);
>                Break;     end;   end;    end;
>
>       If Length(s)=N then
>          begin
>          For i1:=1 to length(S) do
>            begin
>            sr1:=s;
>            If sr1[i1]='1' then sr1[i1]:='0'
>                           else continue;
>            One_summ1(sum);
>              If ((sum)mod(n+1)=0) then
>                begin
>                Writeln(Sr1);
>                Break;     end;    end;    end;
>
>       If Length(s)=N-1 then
>         Begin
>         For i1:=1 to length(S)+1 do
>           begin
>           sr1:=s;     sr2:=s;
>           Insert('1',sr1,i1); Insert('0',sr2,i1);
>           One_summ1(sum);
>              If ((sum)mod(n+1)=0) then
>              begin
>                Writeln(Sr1);
>                Break;
>              end;
>           sr1:=sr2;
>           One_summ1(sum);
>              If ((sum)mod(n+1)=0) then
>              begin
>                Writeln(Sr1);
>                Break;
>                end;       end;      end;
>     until seekEOF;
> End.
>
----------------------------------------------------------------------
------------------
> Maybe then output is INCORRECT.
>               PLEASE, HELP ME OR WRITE SOME TEST!
>                                 Thank you.
>
Help! Help! Help! HELP !!!
Послано Dim 12 май 2003 22:22
Give me some tests or some new ideas,  PLEASE !!!!!
    I want to solve this problem.
          Thanks.
You have a problem with the input
Послано Sergeyev Alexander 9 сен 2003 15:57
read: "except maybe for some extra spaces or line breaks"