|
|
back to boardHelp, 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? 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? 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 |
|
|