fork download
  1. #include <iostream>
  2. using namespace std;
  3. #define lli long long int
  4. lli convertbtod(int n){
  5. lli j = 0,ans=0;
  6. while(n>0){
  7. lli last = n%10;
  8. ans += (last<<j);
  9. j++;
  10. n /= 10;
  11. }
  12. return ans;
  13. }
  14. lli convertdtob(int n){
  15. int ans=0,p = 1;
  16. while (n>0){
  17. ans += p*(n&1);
  18. p*=10;
  19. n = n>>1;
  20. }
  21. return ans;
  22. }
  23. int main() {
  24. lli t;
  25. cin >> t;
  26. while (t--){
  27. lli n1,n2,ans = 0,j=0;
  28. cin >> n1 >> n2;
  29. n1 = convertbtod(n1);
  30. n2 = convertbtod(n2);
  31. while (n1>0 || n2>0){
  32. int l1 = n1&1;
  33. int l2 = n2&1;
  34. if (l1^l2){
  35. ans = ans|(1<<j);
  36. }
  37. j++;
  38. n1 = n1>>1;
  39. n2 = n2>>1;
  40. }
  41. cout << convertdtob(ans) << endl;
  42. }
  43. return 0;
  44. }
  45.  
Success #stdin #stdout 0s 4880KB
stdin
1
101 111
stdout
10