|
|
back to boardShow all messages Hide all messagesDo you known test?I got wa 2,but I think that my program is right) It's my code: var F:array[0..1000000] of longint; I,j,mi,n:longint; Begin Read(n); F[0]:=0; F[1]:=1; F[2]:=2; For i:=3 to n do Begin Mi:=100000; For j:=1 to trunc(sqrt(i)) do If mi>f[i-j*j] then mi:=f[i-j*j]; F[i]:=mi+1; End; Writeln(f[i]); End. Writeln(f[i]); = undefined behaviour first of all, try f[n], not f[i] You are a superman!!!!!!!!!!!!Thanks) |
|
|