|
|
back to boardWhy dose my program get WC? 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!!!!!!!!!!!!!!!!!!!!! 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 |
|
|