|
|
back to boardWHY CE????? #include <iostream.h> #include <math.h> int main(void) { int K; int ind = 1; int L = 0;
cin >> K; if( !(K % 2) ) { while( (!(K % 2)) && (K > 4) ) K /= 2; L = K - 1; ind = 0; }; for(int i = 3 ; ( i <= ceil( sqrt(K) ) ) && ind ; ++i) { if( !(K % i) ) { L = i - 1; ind = 0; }; }; if( (K != 1) && (L == 0) ) L = K - 1; cout << L; return 0; }; //I compiled it under bc 3.0, vc 7.0, vc 6.0 //Please HELP Re: WHY CE????? My program got CE at the first,but when I changed sqrt(K) to sqrt((double)K),it got AC.Maybe you can have a try,good luckЈЎ |
|
|