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\)= =为此又逗比了几次= =

 1 /**************************************************************
 2     Problem: 1349
 3     User: HansBug
 4     Language: Pascal
 5     Result: Accepted
 6     Time:0 ms
 7     Memory:220 kb
 8 ****************************************************************/
 9  
10 var i,j:qword;
11 begin
12      readln(i);
13      j:=trunc(sqrt(i));
14      if (j*j)<>i then inc(j);
15      writeln(j);readln;
16 end.

 

 

转载于:https://www.cnblogs.com/HansBug/p/4487029.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值