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

Help with Problem 1074! Please...
Posted by Evgeny Reshetnikov 12 Jan 2002 19:48
This is program:


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

Procedure Input;
  Begin
    n:=0;
    While a[n]<>'#' Do
      Begin
        Inc(n);
        ReadLn(a[n]);
        If a[n]<>'#' Then
          Begin
            ReadLn(b[n]);
            If b[n]<0 Then
              b[n]:=0;
          End;
      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
                    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
Re: Wow!!!! How can you do a such number of mistakes!!!!!! May be this help you, but I don't think so :-)) (+)
Posted by Nazarov Denis (nsc2001@rambler.ru) 12 Jan 2002 20:30
&#1055;&#1077;&#1088;&#1074;&#1099;&#1081; &#1090;&#1077;&#1089;&#1090;:
10
2
#
&#1055;&#1088;&#1072;&#1074;&#1080;&#1083;&#1100;&#1085;&#1099;&#1081; &#1086;&#1090;&#1074;&#1077;&#1090;: "10.00"
&#1058;&#1074;&#1086;&#1081; &#1086;&#1090;&#1074;&#1077;&#1090;: "10.0"
____________________________________________

&#1042;&#1090;&#1086;&#1088;&#1086;&#1081; &#1090;&#1077;&#1089;&#1090;:
.0e2
1
#
&#1055;&#1088;&#1072;&#1074;&#1080;&#1083;&#1100;&#1085;&#1099;&#1081; &#1086;&#1090;&#1074;&#1077;&#1090;: "0.0"
&#1058;&#1074;&#1086;&#1081; &#1086;&#1090;&#1074;&#1077;&#1090;: ".0"
______________________________________________

 &#1053;&#1077; &#1075;&#1072;&#1088;&#1072;&#1085;&#1090;&#1080;&#1088;&#1091;&#1102;, &#1095;&#1090;&#1086; &#1101;&#1090;&#1086; &#1080;&#1089;&#1095;&#1077;&#1088;&#1087;&#1099;&#1074;&#1072;&#1102;&#1097;&#1080;&#1081; &#1089;&#1087;&#1080;&#1089;&#1086;&#1082; &#1090;&#1077;&#1089;&#1090;&#1086;&#1074;, &#1085;&#1072; &#1082;&#1086;&#1090;&#1086;&#1088;&#1099;&#1093; &#1090;&#1074;&#1086;&#1103;
&#1087;&#1088;&#1086;&#1075;&#1088;&#1072;&#1084;&#1084;&#1072; &#1074;&#1099;&#1076;&#1072;&#1077;&#1090; &#1085;&#1077;&#1087;&#1088;&#1072;&#1074;&#1080;&#1083;&#1100;&#1085;&#1099;&#1081; &#1086;&#1090;&#1074;&#1077;&#1090;.

 &#1047;&#1072;&#1095;&#1077;&#1084; &#1090;&#1099; &#1093;&#1088;&#1072;&#1085;&#1080;&#1096;&#1100; &#1074;&#1089;&#1077; &#1086;&#1090;&#1074;&#1077;&#1090;&#1099; &#1074; &#1087;&#1072;&#1084;&#1103;&#1090;&#1080;? Online Judge &#1087;&#1086;&#1079;&#1074;&#1086;&#1083;&#1103;&#1077;&#1090; &#1089;&#1088;&#1072;&#1079;&#1091;
&#1078;&#1077; &#1087;&#1086;&#1089;&#1083;&#1077; &#1092;&#1086;&#1088;&#1084;&#1080;&#1088;&#1086;&#1074;&#1072;&#1085;&#1080;&#1103; &#1086;&#1090;&#1074;&#1077;&#1090;&#1072; &#1074;&#1099;&#1074;&#1086;&#1076;&#1080;&#1090;&#1100; &#1077;&#1075;&#1086; &#1074; &#1074;&#1099;&#1093;&#1086;&#1076;&#1085;&#1086;&#1081; &#1092;&#1072;&#1081;&#1083;(&#1082;&#1086;&#1085;&#1089;&#1086;&#1083;&#1100;).
&#1058;.&#1077;. &#1085;&#1072; &#1084;&#1086;&#1103; &#1087;&#1088;&#1086;&#1075;&#1088;&#1072;&#1084;&#1084;&#1072; &#1085;&#1072; &#1084;&#1086;&#1077;&#1084; &#1082;&#1086;&#1084;&#1087;&#1077; &#1076;&#1077;&#1083;&#1072;&#1077;&#1090; &#1089;&#1083;&#1077;&#1076;&#1091;&#1102;&#1097;&#1077;&#1077;:

10     /&#1074;&#1074;&#1086;&#1076;&#1103;&#1090;&#1089;&#1103; &#1076;&#1072;&#1085;&#1085;&#1099;&#1077;
2      /&#1089; &#1082;&#1083;&#1072;&#1074;&#1080;&#1072;&#1090;&#1091;&#1088;&#1099;
10.00  /&#1089;&#1088;&#1072;&#1079;&#1091; &#1078;&#1077; &#1074;&#1
Re: Wow!!!! How can you do a such number of mistakes!!!!!! May be this help you, but I don't think so :-)) (+)
Posted by Evgeny Reshetnikov 12 Jan 2002 23:02
> &#1055;&#1077;&#1088;&#1074;&#1099;&#1081; &#1090;&#1077;&#1089;&#1090;:
> 10
> 2
> #
> &#1055;&#1088;&#1072;&#1074;&#1080;&#1083;&#1100;&#1085;&#1099;&#1081; &#1086;&#1090;&#1074;&#1077;&#1090;: "10.00"
> &#1058;&#1074;&#1086;&#1081; &#1086;&#1090;&#1074;&#1077;&#1090;: "10.0"
I do it only because is Problem 1074 task wrote: If after point all
zero then must be one zero! but not in this problem!
> ____________________________________________
>
> &#1042;&#1090;&#1086;&#1088;&#1086;&#1081; &#1090;&#1077;&#1089;&#1090;:
> .0e2
> 1
> #
> &#1055;&#1088;&#1072;&#1074;&#1080;&#1083;&#1100;&#1085;&#1099;&#1081; &#1086;&#1090;&#1074;&#1077;&#1090;: "0.0"
> &#1058;&#1074;&#1086;&#1081; &#1086;&#1090;&#1074;&#1077;&#1090;: ".0"
In my computer! my program give me 0.0!
> ______________________________________________
>
>  &#1053;&#1077; &#1075;&#1072;&#1088;&#1072;&#1085;&#1090;&#1080;&#1088;&#1091;&#1102;, &#1095;&#1090;&#1086; &#1101;&#1090;&#1086; &#1080;&#1089;&#1095;&#1077;&#1088;&#1087;&#1099;&#1074;&#1072;&#1102;&#1097;&#1080;&#1081; &#1089;&#1087;&#1080;&#1089;&#1086;&#1082; &#1090;&#1077;&#1089;&#1090;&#1086;&#1074;, &#1085;&#1072; &#1082;&#1086;&#1090;&#1086;&#1088;&#1099;&#1093;
&#1090;&#1074;&#1086;&#1103;
> &#1087;&#1088;&#1086;&#1075;&#1088;&#1072;&#1084;&#1084;&#1072; &#1074;&#1099;&#1076;&#1072;&#1077;&#1090; &#1085;&#1077;&#1087;&#1088;&#1072;&#1074;&#1080;&#1083;&#1100;&#1085;&#1099;&#1081; &#1086;&#1090;&#1074;&#1077;&#1090;.
>
>  &#1047;&#1072;&#1095;&#1077;&#1084; &#1090;&#1099; &#1093;&#1088;&#1072;&#1085;&#1080;&#1096;&#1100; &#1074;&#1089;&#1077; &#1086;&#1090;&#1074;&#1077;&#1090;&#1099; &#1074; &#1087;&#1072;&#1084;&#1103;&#1090;&#1080;? Online Judge &#1087;&#1086;&#1079;&#1074;&#1086;&#1083;&#1103;&#1077;&#1090; &#1089;&#1088;&#1072;&#1079;&#1091;
> &#1078;&#1077; &#1087;&#1086;&#1089;&#1083;&#1077; &#1092;&#1086;&#1088;&#1084;&#1080;&#1088;&#1086;&#1074;&#1072;&#1085;&#1080;&#1103; &#1086;&#1090;&#1074;&#1077;&#1090;&#1072; &#1074;&#1099;&#1074;&#1086;&#1076;&#1080;&#1090;&#1100; &#1077;&#1075;&#1086; &#1074; &#1074;&#1099;&#1093;&#1086;&#1076;&#1085;&#1086;&#1081; &#1092;&#1072;&#1081;&#1083;(&#1082;&#1086;&#1085;&#1089;&#1086;&#1083;&#1100;).
> &#1058;.&#1077;. &#1085;&#1072; &#1084;&#1086;&#1103; &#1087;&#1088;&#1086;&#1075;&#1088;&#1072;&#1084;&#1084;&#1072; &#1085;&#1072; &#1084;&#1086;&#1077;&#1084; &#1082;&#1086;&#1084;&#1087;&#1077; &#1076;&#1077;&#1083;&#1072;&#1077;&#1090; &#1089;&#1083;&#1077;&#1076;&#1091;&#1102;&#1097;&#1077;&#1077;:
>
> 10     /&#1074;