ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1073. Square Country

Help, why I have Compillation Error?
Posted by sas 3 May 2007 21:37
#include <iostream>
#include <math.h>
using namespace std;

long int c,i,a,s;

int main ()
{
    cin>>a;
    s=0;
    for(;;)
    {
        s++;
        a-=pow(int (sqrt(a)),2);
        if(a==0) break;
    }
    cout<<s<<endl;

    return 0;
}
Re: Help, why I have Compillation Error?
Posted by {AESC USU} Evgeny Kurpilyanskij 3 May 2007 21:50
a-=pow(int (sqrt(a)),2);
-> a-=(int)pow(int (sqrt((double)a)),2.0);


Edited by author 03.05.2007 21:56
Re: Help, why I have Compillation Error?
Posted by CHIDEMYAN SERGEY 3 May 2007 21:50
Error here:
a-=pow(int (sqrt(a)),2);
you must write
a-=pow(int (sqrt((double)a)),2);
P.S. your algorithm gives WA#5!

Edited by author 03.05.2007 21:51

Edited by author 04.05.2007 01:48