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

Общий форум

First TEST Problem 1074! My program work right on all MY tests! Why she get WA!??? Please help!
Послано Evgeny Reshetnikov 11 янв 2002 20:40
This is program:

Program n1074;
  Var
    n,i,j,e,point,left,right,q:byte;
    znak:char;
    a:array [0..250] of string[255];
    b:array [0..250] of byte;
    c:array [0..250] of boolean;

Procedure Input;
  Begin
    n:=0;
    While a[n]<>'#' Do
      Begin
        Inc(n);
        ReadLn(a[n]);
        If a[n]<>'#' Then
          ReadLn(b[n]);
      End;
    Dec(n);
  End;

Procedure Solve;
  Begin
    For i:=1 to n Do
      Begin
        c[i]:=true;
        e:=0;
        point:=0;
        For j:=1 to Length(a[i]) Do
          Begin
            If ((a[i][j]='+') or (a[i][j]='-')) and (Not ((j=1) and
               (a[i][2]>='0') and (a[i][2]<='9'))) and (Not (((a[i][j-
1]='e')
               or (a[i][j-1]='E')) and (a[i][j+1]>='0') and (a[i][j+1]
<='9')))
            Then
              Begin
                c[i]:=false;
                Break;
              End;
            If ((a[i][j]='e') or (a[i][j]='E')) and (Not ((a[i][j-1]
>='0') and
               (a[i][j-1]<='9') and (a[i][j+1]>='0') and (a[i][j+1]
<='9')) and
               Not ((a[i][j-1]>='0') and (a[i][j-1]<='9') and ((a[i]
[j+1]='+')
               or (a[i][j+1]='-'))))
            Then
              Begin
                c[i]:=false;
                Break;
              End;
            If (a[i][j]='.') and (Not (((a[i][j-1]>='0') and (a[i][j-
1]<='9')
               or (j=1)) and (a[i][j+1]>='0') and (a[i][j+1]<='9')))
            Then
              Begin
                c[i]:=false;
                Break;
              End;
            If (a[i][j]='e') or (a[i][j]='E') Then
              Inc(e);
            If a[i][j]='.' Then
              Inc(point);
            If Not ((a[i][j]>='0') and (a[i][j]<='9')) and Not ((a[i]
[j]='e')
               or (a[i][j]='E')) and Not ((a[i][j]='+') or (a[i][j]='-
')) and
               Not (a[i][j]='.') and Not ((Ord(a[i][j])=10) or (Ord(a
[i][j])=13)
               or (Ord(a[i][j])=26)) and (a[i][j]<>' ') Then
              Begin
                c[i]:=false;
                Break;
              End;
          End;
        If (e>1) or (point>1) Then
          c[i]:=false;
        If a[i][1]='+' Then
          Delete(a[i],1,1);
        For j:=1 to Length(a[i]) Do
          If (a[i][j]='.') and (j=1) Then
            Insert('0',a[i],j-1);
      End;
  End;

Procedure Solve2;
  Begin
    For i:=1 to n Do
      If c[i]=true Then
        Begin
          left:=0;
          right:=0;
          For j:=1 to Length(a[i]) Do
            If (a[i][j]='e') or (a[i][j]='E') Then
              Begin
                If a[i][j+1]='+' Then
                  Begin
                    For q:=(j+2) to Length(a[i]) Do
                      right:=right*10+(Ord(a[i][q])-Ord('0'));
                    Delete(a[i],j,Length(a[i])-j+1);
                    Break;
                  End
                Else
                  If (a[i][j+1]>='0') and (a[i][j+1]<='9') Then
                    Begin
                      For q:=(j+1) to Length(a[i]) Do
                        right:=right*10+(Ord(a[i][q])-Ord('0'));
                      Delete(a[i],j,Length(a[i])-j+1);
                      Break;
                    End
                  Else
                    If a[i][j+1]='-' Then
                      Begin
                        For q:=(j+2) to Length(a[i]) Do
                          left:=left*10+(Ord(a[i][q])-Ord('0'));
                        Delete(a[i],j,Length(a[i])-j+1);
                        Break;
                      End;
              End;
           If right<>0 Then
             Begin
               For j:=1 to Length(a[i]) Do
                 If a[i][j]='.' Then
                   Break;
               If j&amp
Re: First TEST Problem 1074! My program work right on all MY tests! Why she get WA!??? Please help!
Послано mih 11 янв 2002 21:25
>     a:array [0..250] of string[255];
1.don't store all the strings in array. i suppose there might be more
than 250 of them
2.
your prog is correct for:
.1
2
but uncorrect for
+.1
2
and
-.1
2
------
it says "not valid" but as you can see both these examples are correct
Re: First TEST Problem 1074! My program work right on all MY tests! Why she get WA!??? Please help!
Послано Evgeny Reshetnikov 11 янв 2002 23:39
> >     a:array [0..250] of string[255];
> 1.don't store all the strings in array. i suppose there might be
more
> than 250 of them
> 2.
> your prog is correct for:
> .1
> 2
> but uncorrect for
> +.1
> 2
> and
> -.1
> 2
> ------
> it says "not valid" but as you can see both these examples are
correct
>
>
Thank you! But my program WRONG and now! Thank you for Help!
.. =) Test very awful!
This is:

Program n1074;
  Var
    n,i,j,e,point,left,right,q:byte;
    znak:char;
    a:array [0..250] of string[255];
    b:array [0..250] of byte;
    c:array [0..250] of boolean;

Procedure Input;
  Begin
    n:=0;
    While a[n]<>'#' Do
      Begin
        Inc(n);
        ReadLn(a[n]);
        If a[n]<>'#' Then
          ReadLn(b[n]);
      End;
    Dec(n);
  End;

Procedure Solve;
  Begin
    For i:=1 to n Do
      Begin
        c[i]:=true;
        e:=0;
        point:=0;
        For j:=1 to Length(a[i]) Do
          Begin
            If ((a[i][j]='+') or (a[i][j]='-')) and (Not ((j=1) and
               (a[i][2]>='0') and (a[i][2]<='9'))) and (Not (((a[i][j-
1]='e')
               or (a[i][j-1]='E')) and (a[i][j+1]>='0') and (a[i][j+1]
<='9')))
               and (Not ((j=1) and (a[i][2]='.')))
            Then
              Begin
                c[i]:=false;
                Break;
              End;
            If ((a[i][j]='e') or (a[i][j]='E')) and (Not ((a[i][j-1]
>='0') and
               (a[i][j-1]<='9') and (a[i][j+1]>='0') and (a[i][j+1]
<='9')) and
               Not ((a[i][j-1]>='0') and (a[i][j-1]<='9') and ((a[i]
[j+1]='+')
               or (a[i][j+1]='-'))))
            Then
              Begin
                c[i]:=false;
                Break;
              End;
            If (a[i][j]='.') and (Not (((a[i][j-1]>='0') and (a[i][j-
1]<='9')
               or (j=1)) and (a[i][j+1]>='0') and (a[i][j+1]<='9')))
and
               Not((j=2) and ((a[i][1]='+') or (a[i][1]='-')))
            Then
              Begin
                c[i]:=false;
                Break;
              End;
            If (a[i][j]='e') or (a[i][j]='E') Then
              Inc(e);
            If a[i][j]='.' Then
              Inc(point);
            If Not ((a[i][j]>='0') and (a[i][j]<='9')) and Not ((a[i]
[j]='e')
               or (a[i][j]='E')) and Not ((a[i][j]='+') or (a[i][j]='-
')) and
               Not (a[i][j]='.') and Not ((Ord(a[i][j])=10) or (Ord(a
[i][j])=13)
               or (Ord(a[i][j])=26)) and (a[i][j]<>' ') Then
              Begin
                c[i]:=false;
                Break;
              End;
          End;
        If (e>1) or (point>1) Then
          c[i]:=false;
        If a[i][1]='+' Then
          Delete(a[i],1,1);
        For j:=1 to Length(a[i]) Do
          If (a[i][j]='.') and (j=1) Then
            Insert('0',a[i],j-1);
      End;
  End;

Procedure Solve2;
  Begin
    For i:=1 to n Do
      If c[i]=true Then
        Begin
          left:=0;
          right:=0;
          For j:=1 to Length(a[i]) Do
            If (a[i][j]='e') or (a[i][j]='E') Then
              Begin
                If a[i][j+1]='+' Then
                  Begin
                    For q:=(j+2) to Length(a[i]) Do
                      right:=right*10+(Ord(a[i][q])-Ord('0'));
                    Delete(a[i],j,Length(a[i])-j+1);
                    Break;
                  End
                Else
                  If (a[i][j+1]>='0') and (a[i][j+1]<='9') Then
                    Begin
                      For q:=(j+1) to Length(a[i]) Do
                        right:=right*10+(Ord(a[i][q])-
and again =)
Послано mih 12 янв 2002 00:47
>     a:array [0..250] of string[255];
1.don't store all the strings in array. i suppose there might be
more than 250 of them
this could be wa reason because if there is >251 numbers in a file
your prog won't be able to read them all
2.
{in}
-.1
1
{/in}
is correct now, but
{in}
-.
1
{/in}
and
{in}
+.
1
{/in}
says 0.0
however both of them are not valid floating p. numbers.

GL!
Re: and again =) and again... and again... =(
Послано Evgeny Reshetnikov 12 янв 2002 03:52
> >     a:array [0..250] of string[255];
> 1.don't store all the strings in array. i suppose there might be
> more than 250 of them
> this could be wa reason because if there is >251 numbers in a file
> your prog won't be able to read them all
> 2.
> {in}
> -.1
> 1
> {/in}
> is correct now, but
> {in}
> -.
> 1
> {/in}
> and
> {in}
> +.
> 1
> {/in}
> says 0.0
> however both of them are not valid floating p. numbers.
>
> GL!
>
And my program again wrong on first test! wrong on 0.01 sec... =(

Whis is it:
My array is comments... when i submitted my program i deleted comment!

Program n1074;
  Var
    n,i,j,e,point,left,right,q:longint;
    znak:char;
    a:array [0..100{0}] of string[255];
    b:array [0..100{0}] of byte;
    c:array [0..100{0}] of boolean;

Procedure Input;
  Begin
    n:=0;
    While a[n]<>'#' Do
      Begin
        Inc(n);
        ReadLn(a[n]);
        If a[n]<>'#' Then
          ReadLn(b[n]);
      End;
    Dec(n);
  End;

Procedure Solve;
  Var
    pp:boolean;
  Begin
    For i:=1 to n Do
      Begin
        c[i]:=true;
        e:=0;
        point:=0;
        pp:=true;
        For j:=1 to Length(a[i]) Do
          If (a[i][j]>='0') and (a[i][j]<='9') Then
            pp:=false;
        If pp=true Then
          c[i]:=false;
        For j:=1 to Length(a[i]) Do
          Begin
            If ((a[i][j]='+') or (a[i][j]='-')) and (Not ((j=1) and
               (a[i][2]>='0') and (a[i][2]<='9'))) and (Not (((a[i][j-
1]='e')
               or (a[i][j-1]='E')) and (a[i][j+1]>='0') and (a[i][j+1]
<='9')))
               and (Not ((j=1) and (a[i][2]='.')))
            Then
              Begin
                c[i]:=false;
                Break;
              End;
            If ((a[i][j]='e') or (a[i][j]='E')) and (Not ((a[i][j-1]
>='0') and
               (a[i][j-1]<='9') and (a[i][j+1]>='0') and (a[i][j+1]
<='9')) and
               Not ((a[i][j-1]>='0') and (a[i][j-1]<='9') and ((a[i]
[j+1]='+')
               or (a[i][j+1]='-'))))
            Then
              Begin
                c[i]:=false;
                Break;
              End;
            If (a[i][j]='.') and (Not (((a[i][j-1]>='0') and (a[i][j-
1]<='9')
               or (j=1)) and (a[i][j+1]>='0') and (a[i][j+1]<='9')))
and
               Not((j=2) and ((a[i][1]='+') or (a[i][1]='-')))
            Then
              Begin
                c[i]:=false;
                Break;
              End;
            If (a[i][j]='e') or (a[i][j]='E') Then
              Inc(e);
            If a[i][j]='.' Then
              Inc(point);
            If Not ((a[i][j]>='0') and (a[i][j]<='9')) and Not ((a[i]
[j]='e')
               or (a[i][j]='E')) and Not ((a[i][j]='+') or (a[i][j]='-
')) and
               Not (a[i][j]='.') and Not ((Ord(a[i][j])=10) or (Ord(a
[i][j])=13)
               or (Ord(a[i][j])=26)) and (a[i][j]<>' ') Then
              Begin
                c[i]:=false;
                Break;
              End;
          End;
        If (e>1) or (point>1) Then
          c[i]:=false;
        If a[i][1]='+' Then
          Delete(a[i],1,1);
        For j:=1 to Length(a[i]) Do
          If (a[i][j]='.') and (j=1) Then
            Insert('0',a[i],j-1);
      End;
  End;

Procedure Solve2;
  Begin
    For i:=1 to n Do
      If c[i]=true Then
        Begin
          left:=0;
          right:=0;
          For j:=1 to Length(a[i]) Do
            If (a[i][j]='e') or (a[i][j]='E') Then
              Begin
                If a[i][j+1]='+' Then
                  Begin