Saleh127

live ar 6809

Jul 28th, 2020 (edited)
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ui unsigned int
  4. #define fellow_junior ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  5. int main()
  6. {
  7. fellow_junior
  8. int t,i,j,left,right;
  9. ui a,c,d,e;
  10. scanf("%d",&t);
  11. for(i=1;i<=t;i++)
  12. {
  13. scanf("%X %X",&a,&c);
  14. d=a,e=c;
  15. left=right=0;
  16. while(d!=e && left<=31)
  17. {
  18. d=(d<<1)|(d>>31);
  19. left++;
  20. }
  21. while(a!=c && right<=31 && left!=32)
  22. {
  23. a=(a>>1)|(a<<31);
  24. right++;
  25. }
  26. if(left==32) printf("Case #%d: Not possible\n",i);
  27. else if(left<right) printf("Case #%d: %d Left\n",i,left);
  28. else if(left>right) printf("Case #%d: %d Right\n",i,right);
  29. else printf("Case #%d: %d Any\n",i,left);
  30. }
  31.  
  32.  
  33. return 0;
  34. }
  35.  
Add Comment
Please, Sign In to add comment