|
|
вернуться в форумWhy CE!?Help me!I have comiled it in my computer!!! #include <iostream> #include <math.h> using namespace std; long long a,b; long long i,j; long long sum,maxi; double s; double maxn; int main () { cin>>a>>b; maxn=100000; for (i=a;i<=b;i++) { sum=1; for (j=2;j<sqrt(i);j++) if (i%j==0) sum=sum+j+i/j; if (((long long)(sqrt(i)))*((long long)(sqrt(i)))==i) sum=sum+(long long)(sqrt(i)); s=(double)sum/i; if (s<maxn) { maxn=s; maxi=i; } } cout<<maxi<<endl; return (0); } Edited by author 13.09.2007 17:13 Re: Why CE!?Help me!I have comiled it in my computer!!! try to overload function "sqrt" for "long long" long long sqrt(long long x) { return (long long)sqrt((double) x); } by the way you must to use "__int64" instead of "long long" you can use option "Reply" when submit your solution To this E-Mail address your@email.adress and you have got such a message: You tried to solve problem 1118 Nontrivial numbers. Your solution was compiled with the following errors: 641078b2-a88c-43db-be02-6b6e5e5dd8fc 641078b2-a88c-43db-be02-6b6e5e5dd8fc(21): error: more than one instance of overloaded function "sqrt" matches the argument list: function "sqrt(double)" function "sqrt(float)" function "sqrt(long double)" argument types are: (__int64) for (j=2;j<sqrt(i);j++) ^ 641078b2-a88c-43db-be02-6b6e5e5dd8fc(23): error: more than one instance of overloaded function "sqrt" matches the argument list: function "sqrt(double)" function "sqrt(float)" function "sqrt(long double)" argument types are: (__int64) if (((long long)(sqrt(i)))*((long long)(sqrt(i)))==i) sum=sum+(long long)(sqrt(i)); ^ 641078b2-a88c-43db-be02-6b6e5e5dd8fc(23): error: more than one instance of overloaded function "sqrt" matches the argument list: function "sqrt(double)" function "sqrt(float)" function "sqrt(long double)" argument types are: (__int64) if (((long long)(sqrt(i)))*((long long)(sqrt(i)))==i) sum=sum+(long long)(sqrt(i)); ^ 641078b2-a88c-43db-be02-6b6e5e5dd8fc(23): error: more than one instance of overloaded function "sqrt" matches the argument list: function "sqrt(double)" function "sqrt(float)" function "sqrt(long double)" argument types are: (__int64) if (((long long)(sqrt(i)))*((long long)(sqrt(i)))==i) sum=sum+(long long)(sqrt(i)); ^ 641078b2-a88c-43db-be02-6b6e5e5dd8fc(32): warning #1: last line of file ends without a newline } ^ compilation aborted for 641078b2-a88c-43db-be02-6b6e5e5dd8fc (code 2) Re: Why CE!?Help me!I have comiled it in my computer!!! I see,and I've AC it |
|
|