Advertisement
raisul82

LIGHTOJ 1116 - Ekka Dokka

Jul 27th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. long long int n,L,res1,res2,t,m=0,j;
  6. scanf("%lld",&t);
  7. while(t-- && scanf("%lld",&n)==1)
  8. {
  9. L=n/2;
  10. res1=0;
  11. res2=0;
  12. for(j=2; j<=L; j=j*2)
  13. {
  14. if(n%j==0)
  15. {
  16. res1=n/j;
  17. if(res1%2==1)
  18. {
  19. res2=j;
  20. break;
  21. }
  22. }
  23.  
  24.  
  25. }
  26.  
  27. if(res2!=0)
  28. {
  29. printf("Case %lld: %lld %lld\n",++m,res1,res2);
  30. }
  31. else
  32. {
  33. printf("Case %lld: Impossible\n",++m);
  34. }
  35.  
  36. }
  37.  
  38. return 0;
  39.  
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement