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

My Solution Here:
Posted by Destiny 11 Nov 2002 18:03
program sinus;
var
 i,n,depth:integer;
procedure calc(i:integer);
var
 j:integer;
begin
 if i=depth+1 then
  for j:=1 to depth do
   write(')')
 else
  begin
   write('sin(',i);
   if i<depth then
    if odd(i) then
     write('-')
    else
     write('+');
   calc(i+1);
  end;
end;
begin
 readln(n);
 for i:=1 to n-1 do
  write('(');
 for i:=1 to n-1 do
  begin
   depth:=i;
   calc(1);
   write('+',n-i+1,')');
  end;
 depth:=n;
 calc(1);
 writeln('+1');
end.
OK,accept
Posted by zhbs 14 Nov 2002 12:49