前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >1349: [Baltic2006]Squint

1349: [Baltic2006]Squint

作者头像
HansBug
发布2018-04-11 10:45:36
5010
发布2018-04-11 10:45:36
举报
文章被收录于专栏:HansBug's LabHansBug's Lab

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

代码语言:javascript
复制
 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.
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2015-05-08 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 1349: [Baltic2006]Squint
  • Description
  • Input
  • Output
  • Sample Input
  • Sample Output
  • HINT
  • Source
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档