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 1248. Sequence Sum

people help me!!!!!!!! wa 4 give me wrong test please!!!
Posted by +FAMAS+ 1 Oct 2005 02:14
 var
a,b:array[-250..250] of byte;
x1,x,i,j,n,code:integer; s:string;
procedure E;
  var i,ymn,t:integer; minus:boolean;
begin
  minus:=false; ymn:=0;  t:=0;
  for i:=1 to length(s) do
  if (s[i]='e') or (s[i]='E') then
  begin
   t:=i+1;
   val(copy(s,t,length(s)-t+1),ymn,code);
   delete(s,i,length(s)-i+1);
   break;
  end;
  t:=0;
  for i:=1 to length(s) do
  if s[i]='.' then t:=i-1;
  if t<>0 then delete(s,t+1,1);
  if t=0 then t:=length(s);
  ymn:=ymn+t;
  if ymn<=0 then
   begin
    for i:=1 to abs(ymn) do s:='0'+s;
    s:='.'+s;
    s:='0'+s;
   end
  else
   begin
    if ymn<length(s) then insert('.',s,ymn+1)
    else
    begin
       ymn:=ymn-length(s);
       for i:=1 to ymn do s:=s+'0';
    end;
   end;
end;
begin

{   assign(input,'c:\test.txt');
   reset(input);}
   readln(n);
   for i:=1 to n do
      begin
         fillchar(b,sizeof(b),0);
         readln(s);
         if pos('.',s)=0 then
         if pos('e',s)=0 then s:=s+'.0' else insert('.0',s,pos('e',s));
         E;
         if pos('.',s)=0 then s:=s+'.0';
         for j:=pos('.',s)-1 downto 1 do begin val(s[j],x,code); b[j-pos('.',s)]:=x; end;

         for j:=pos('.',s)+1 to length(s) do begin val(s[j],x,code); b[j-pos('.',s)]:=x; end;

         x:=0;

         for j:=200 downto 1 do
           begin
                 x1:=x;
                 x:=(b[j]+a[j]+x1) div 10;
                 a[j]:=(a[j]+b[j]+x1) mod 10;
           end;

         for j:=-1 downto -200 do
               begin
                 x1:=x;
                 x:=(b[j]+a[j]+x1) div 10;
                 a[j]:=(a[j]+b[j]+x1) mod 10;
               end;
      end;
{      for i:=-10 to 10 do write(a[i]);}
    x:=0;
    for i:=-200 to 0 do if a[i]<>0 then break;
    if i<>0 then
      begin
         write(a[i],'.');
         x:=i+1;
         j:=0;
         for i:=x to 200 do
         if i<>0 then
            begin
              inc(j);
              if j=19 then break else write(a[i]);
            end;
         write('e',abs(x));
      end
    else
    begin
    j:=0;
    for i:=1 to 200 do if a[i]<>0 then break;
    x:=-(i);
    if i=200 then x:=0;
    write(a[i],'.');
    for i:=abs(x)+1 to 250 do
      begin
              inc(j);
              if j=19 then break else write(a[i]);
      end;
     write('e',x);
    end;
end.
Re: people help me!!!!!!!! wa 4 give me wrong test please!!!
Posted by Pio (BSU) 18 Nov 2005 16:35
I think you must round answer!!!
You must be more attentively. Read forum!!!

Test special for your programm:
3
1.999999999999999999e-11
0.080000000000000000e-9
0.000000000000000009e-12

My Ac programm answer:
1.000000000000000000e-10

I hope this test will help you!!!