|
|
вернуться в форумDon't you think something is tricky here? Don't you think something is tricky with this question? If A and P are to be natural numbers, then what is the answer if N=0 Re: Don't you think something is tricky here? > Sorry.....see wrongly.......n > 0 but......how come I can't get AC? program simple; var n,a,p,i,n2:longint; begin readln(n); a:=0; p:=0; n2:=0; inc(a); repeat n2:=n2+a+p; inc(p); until n2>=n; a:=a+(n2-n); p:=p-(n2-n); writeln(a,' ',p); end. Your program gives wrong answer for n=23 Your program writes 6 2 the answer is 11 2 |
|
|