|
|
вернуться в форумNo subject Послано tryit1 24 сен 2011 16:27 I get WA on test 11. Why is that ? I run a loop from 1 to sqrt(n) ,for each i , i check if i is odd or n/i is odd and a perfect square , if yes i store it in ans. int main() { long long n,i; long long ans=1; scanf(" %lld",&n); for(i=3;i*i<=n;i++){ if((n%i)==0){ long long j=sqrtl(i); if (j*j==i and (i&1)) ans=max(ans,i); j=sqrtl(n/i); if (j*j==(n/i) and ((n/i) &1) ) ans=max(ans,n/i);
} } printf("%lld\n",ans); return 0; } Re: No subject IF YOU DID'N GET WA,YOU STILL GOT TLE!!! 悲催啊!!! Re: No subject try 9. I think it should output 9. And this algo seems to output 1. Re: No subject Послано SerCe 24 сен 2011 18:01 Very indefinite problem! Re: No subject Послано SerCe 24 сен 2011 19:52 Edited by author 24.09.2011 19:52 |
|
|