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 1324. Extra Spaces

Why I got WA?Help me!
Posted by Z H Pascal 23 Jul 2004 09:12
Here is my program:program Space;
  var L, R, I, J, K : longint;
      s : array [1.. 1000] of longint;
  begin
    readln (L);
    if L < 2 then R := 0;
    for I := 1 to 1000 do s [I] := 0;
    if L > 1 then
      begin
        I := 2;
        J := 2;
        s [1] := 2;
        R := 1;
        repeat
          if L > J then
            begin
              inc (R);
              s [R] := I;
              if R > 3 then inc (s [R]);
              I := J + 1;
              J := (I + 2 - s [R]) * s [R] - 2;
            end;
        until L <= J;
      end;
    writeln (R);
    for I := R downto 1 do writeln (s [I]);
  end.
Re: Why I got WA?Help me!
Posted by Oleg Strekalovsky [Vologda SPU] 19 Jul 2010 01:42
As for me - I don't try to create solution by "jumps".
I go from 2 to N and some times add i/2+1 to answer.