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 1149. Sinus Dances

Why dose my program get WC?
Posted by mikegreen7892003 21 Aug 2005 15:42
var
  n:byte;
procedure a(now,step:byte);
  begin
    if now=step then
      write('sin(',now,')')
    else
      begin
        write('sin(',now);
        if now mod 2=1 then write('-') else write('+');
        a(now+1,step);
        write(')');
      end;
  end;
procedure s(step:byte);
  begin
    if step=1 then
      begin
        write('(');
        a(1,step);
        write('+',n-step+1,')');
      end
    else
      begin
        if step<>n then
          write('(');
        s(step-1);
        a(1,step);
        write('+',n-step+1);
        if step<>n then
          write(')');
      end;
  end;
begin
  readln(n);
  s(n);
  writeln;
end.
I get AC!!!!!!!!!!!!!!!!!!!!!
Posted by mikegreen7892003 21 Aug 2005 15:50
var
  n:byte;
procedure a(now,step:byte);
  begin
    if now=step then
      write('sin(',now,')')
    else
      begin
        write('sin(',now);
        if now mod 2=1 then write('-') else write('+');
        a(now+1,step);
        write(')');
      end;
  end;
procedure s(step:byte);
  begin
    if step=1 then
      begin
        if step<>n then
          write('(');
        a(1,step);
        write('+',n-step+1);
        if step<>n then
          write(')');
      end
    else
      begin
        if step<>n then
          write('(');
        s(step-1);
        a(1,step);
        write('+',n-step+1);
        if step<>n then
          write(')');
      end;
  end;
begin
  readln(n);
  s(n);
  writeln;
end.
Re: I get AC!!!!!!!!!!!!!!!!!!!!!
Posted by evjava 8 Nov 2009 23:35
in
5
out
((((sin(1)+5)sin(1-sin(2))+4)sin(1-sin(2+sin(3)))+3)sin(1-sin(2+sin(3-sin(4))))+2)sin(1-sin(2+sin(3-sin(4+sin(5)))))+1

Edited by author 08.11.2009 23:59