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 does my program get WA?
Posted by Savior 14 Mar 2002 20:39
var i,n:byte;

procedure a(g:byte);
var i:byte;
begin
  for i:=1 to g-1 do write('sin(',i,'+');
  write('sin(',g);
  for i:=1 to g do write(')');
end;

begin
  readln(n);
  for i:=1 to n-1 do write('(');
  for i:=1 to n-1 do
    begin
      a(i);
      write('+',n+1-i,')');
    end;
  a(n);
  write('+1');
end.
Try recursion (BTW there's a way without it but it's not like your program) :) (-)
Posted by Miguel Angel 14 Mar 2002 23:08
> var i,n:byte;
>
> procedure a(g:byte);
> var i:byte;
> begin
>   for i:=1 to g-1 do write('sin(',i,'+');
>   write('sin(',g);
>   for i:=1 to g do write(')');
> end;
>
> begin
>   readln(n);
>   for i:=1 to n-1 do write('(');
>   for i:=1 to n-1 do
>     begin
>       a(i);
>       write('+',n+1-i,')');
>     end;
>   a(n);
>   write('+1');
> end.
Re: Why does my program get WA?
Posted by Yuan 15 Mar 2002 11:36
where is the subtraction sign?
Re: Why does my program get WA?
Posted by Savior 15 Mar 2002 20:01
> where is the subtraction sign?

OH! Thank you.
I am so foolish.