1349: [Baltic2006]Squint

时间:2023-03-09 01:57:48
1349: [Baltic2006]Squint

1349: [Baltic2006]Squint

Time Limit: 1 Sec  Memory Limit: 64 MB
Submit: 427  Solved: 248
[Submit][Status][Discuss]

Description

Write a program to calculate integer square roots.

Input

The input is read from a text file named squint.in. Its only line consists of an integer 0 < = n < 2^63 .

Output

Its only line consists of the smallest nonnegative integer q such that q^2 >= n .

Sample Input

122333444455555

Sample Output

11060446

HINT

sqrt(122333444455555)=11060445.038765619 .

Source

题解:题目说的很明白了——跟我念square root——平方根= =

然后就没别的了,注意设求出的平方根为r,则\({r}^{2} >= N\)= =为此又逗比了几次= =

 /**************************************************************
Problem:
User: HansBug
Language: Pascal
Result: Accepted
Time: ms
Memory: kb
****************************************************************/ var i,j:qword;
begin
readln(i);
j:=trunc(sqrt(i));
if (j*j)<>i then inc(j);
writeln(j);readln;
end.