Cod sursă (job #111219)
Utilizator |
|
IP | ascuns |
---|---|---|---|
Problemă | Sqrt (clasele 9-10) | Compilator | cpp | 0,40 kb |
Rundă | Tema 13 clasele 9-10 2014/15 | Status | evaluat |
Dată | 27 ian. 2015 21:39:42 | Scor | 0 |
#include <stdio.h>
using namespace std;
FILE *fin ,*fout;
int main()
{
fin = fopen("sqrt.in", "r");
fout = fopen("sqrt.out" ,"w");
long long n ,aux=0 ,pas;
pas=1<<30;
fscanf(fin ,"%lld" ,&n);
while(pas!=0)
{
if((aux+pas)*(aux+pas)<=n)
{
aux+=pas;
}
pas/=2;
}
fprintf(fout ,"%lld" ,aux);
return 0;
}