wojiaocbj

bitop1

Apr 24th, 2022
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.01 KB | None | 0 0
  1. /*
  2.  Author: 曹北健(37509)
  3.  Result: AC Submission_id: 4365351
  4.  Created at: Wed Apr 20 2022 19:09:14 GMT+0800 (China Standard Time)
  5.  Problem: 5594  Time: 11    Memory: 1628
  6. */
  7.  
  8. #include <stdio.h>
  9. #include <stdlib.h>
  10. #include <math.h>
  11. #include <string.h>
  12. #include <ctype.h>
  13. #include <time.h>
  14. #pragma warning(disable:4996)
  15. typedef long long LL;
  16. typedef unsigned long long ULL;
  17. #define GETBIT64(x,i) ((long long)(x)>>(long long)(i))&1ll
  18. LL gcd(LL a, LL b){
  19.     return a % b ? gcd(b, a % b) : b;
  20. }
  21. int main(){
  22. #ifdef _DEBUG
  23.     FILE *fp = freopen("../../../input.txt", "r", stdin);
  24.     //FILE *fp2 = freopen("output.txt", "w", stdout);
  25. #endif // _DEBUG
  26.     LL a, b, x1, x2, i, ans = 0;
  27.     while(~scanf("%lld%lld", &a, &b)){
  28.         ans = 0;
  29.         for(i = 0; i < 64; i++){
  30.             x1 = GETBIT64(a, i);
  31.             x2 = GETBIT64(b, i);
  32.             if(!((!x1) && x2)){
  33.                 ans |= (1ll << i);
  34.             }
  35.         }
  36.         printf("%lld\n", ans);
  37.     }
  38. #ifdef _DEBUG
  39.     freopen("CON", "r", stdin);
  40.     //freopen("CON", "w", stdout);
  41.     system("pause");
  42. #endif // _DEBUG
  43.     return 0;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment