|
|
вернуться в форумPlease tell me why my code got WA! It's very simple,isn't it? var i,k:integer; begin readln(K); for i:=3 to round(sqrt(k)) do if k mod i=0 then begin k:=i; break end; writeln(k-1); end. I got AC now,but why? > It's very simple,isn't it? > > var > i,k:integer; > begin > readln(K); > for i:=3 to round(sqrt(k)) do if k mod i=0 then begin k:=i; break end; > writeln(k-1); > end. if I modify it to : for i:=3 to round(sqrt(k))+100, it is AC. if modify to round()+1 or +2 , WA Finally, I use : for i:=3 to 10000 :( simple... test ur program with k = 26 and u'll know why :) Re: simple... I got it ! Thank you ! ^_^ > test ur program with k = 26 and u'll know why :) |
|
|