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,则r2>=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.
复制代码

 

 
posted @   HansBug  阅读(257)  评论(0编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
阅读排行:
· winform 绘制太阳,地球,月球 运作规律
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· 上周热点回顾(3.3-3.9)
点击右上角即可分享
微信分享提示