1349: [Baltic2006]Squint
Time Limit: 1 Sec Memory Limit: 64 MB
Submit: 572 Solved: 338
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
题解:
哇这种题还需要题解嘛
#include<cstdio>
#include<iostream>
#include<cmath>
using namespace std;
long long a,b;
int main(){
scanf("%lld",&a);b=sqrt(a);
if(b*b==a) printf("%lld",b);
else printf("%lld",b+1);
return 0;
}