|
|
back to boardCompilation error, but i've compiled it using 3 different compilers at home... ---------------------------------------------- #include <iostream.h> #include <math.h> #define MAX_N 1000 #define MAX_P 15000 int ns[MAX_N]; int N, K; int M; int prost[MAX_P]; int count=0; int main() { M=0; cin>>N; int i; for(i=0; i<N; i++) { cin>>ns[i]; if (ns[i]>M) M=ns[i]; } prost[0]=2; prost[1]=3; prost[2]=5; count=3;
int p=7; while (count<M) { int j; int qp = (int)sqrt(p)+1; for (j=0; (j<count)&&(p%prost[j])&& (qp>=prost[j]); j++); if (p%prost[j]) prost[count++]=p;
p+=2; }
for (i=0; i<N; i++) cout<<prost[ns[i]-1]<<endl; return 0; } Re: Compilation error, but i've compiled it using 3 different compilers at home... You tried to solve problem 1069. Your solution on C++ was compiled with the following errors: 69333 temp\69333(39) : error C2668: 'sqrt' : ambiguous call to overloaded function Wonder how I got it ? Just check "I want to recieve result by email" And you'll get it. I suggest using something like sqrt((double)p) It is a common errror |
|
|