ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1854. Negotiations with Parthians

No subject
Posted by tryit1 24 Sep 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
Posted by Shizhouxing 24 Sep 2011 17:20
IF YOU DID'N GET WA,YOU STILL GOT TLE!!!
悲催啊!!!
Re: No subject
Posted by Anonymous 24 Sep 2011 17:22
try 9. I think it should output 9. And this algo seems to output 1.
Re: No subject
Posted by SerCe 24 Sep 2011 18:01
Very indefinite problem!
Re: No subject
Posted by SerCe 24 Sep 2011 19:52


Edited by author 24.09.2011 19:52