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 1001. Reverse Root

What's wrong with my code? (Pascal)
Posted by genchildren 15 Dec 2016 22:25
var j,i,n:longint;
m:array of real;
begin
n:=1;
while not seekeof do
begin
read(j);
SetLength(m,n);
m[n]:=sqrt(j);
inc(n);
end;
for i:=n to 1 do
writeln(m[i]:0:4);
end.
Re: What's wrong with my code? (Pascal)
Posted by Zteeks 18 Dec 2016 03:27
1. chek type of j. You may have input = 10^18, but max in longint ≈ 2*10^9.
2. Write size of array.
2. Don't know what this is: SetLength(m,n); delete this nah)
3. for i:=n to 1 do    |=>   for i:=n downto 1 do
4. Chek why for this input: 9.
your output is 0.0000 3.0000
little change your programm and get AC))

Edited by author 18.12.2016 03:29
Re: What's wrong with my code? (Pascal)
Posted by genchildren 19 Dec 2016 19:39
AC now, thank you
Re: What's wrong with my code? (Pascal)
Posted by Zteeks 20 Dec 2016 02:59
=))