fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define all(v) ((v).begin()), ((v).end())
  4. #define pb push_back
  5. #define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  6. #define MP make_pair
  7. #define sz(x) ((int)((x).length()))
  8. #define fi first
  9. #define se second
  10. #define rep(i,n) for(int i=0;i<n;i++)
  11. #define clr(v,d) memset(v, d, sizeof(v))
  12. #define print cout<<
  13. const double EPS = 1e-12;
  14. const double PI = acos(-1.0);
  15. typedef long long ll;
  16. const ll mod = ll(1e9 + 7);
  17. string t_s(int x)
  18. {
  19. stringstream ss;
  20. ss << x;
  21. string y;
  22. ss >> y;
  23. return y;
  24. }
  25.  
  26. /*vector<long long > prime(1e6,true);
  27. void primenumber()
  28. {
  29.   prime[0]=prime[1]=0;
  30.   for(ll i=2; i<=1e6; i++)
  31.   {
  32.   if(prime[i])
  33.   {
  34.   for(ll j=i*i; j<=1e6; j+=i)
  35.   prime[j]=false;
  36.   }
  37.   }
  38. }*/
  39. /*int cnt_ones(ll val)
  40. {
  41.   int ret=0;
  42.   while(val>0)
  43.   {
  44.   ret++;
  45.   val=val&(val-1);
  46.   }
  47.   return ret;
  48. }*/
  49. /*int div(int n){
  50. int c=0;
  51. for(ll i=1;i*i<=n;i++){
  52.   if(n%i==0&&i*i!=n)c++;
  53.   if(n%i==0)c++;
  54. }
  55.   return c;
  56. }*/
  57. //freopen("commandos.in", "r", stdin);
  58. //freopen("output.txt", "w", stdout);
  59. long long convertDecimalToBinary(long long n)
  60. {
  61. long long binaryNumber = 0;
  62. int remainder, i = 1;
  63.  
  64. while (n!=0)
  65. {
  66. remainder = n%2;
  67. n /= 2;
  68. binaryNumber += (remainder?0:1)*i;
  69. i *= 2;
  70. }
  71. return binaryNumber;
  72. }
  73. int main()
  74. {
  75. int t,test=0;
  76. cin>>t;
  77. while(t--)
  78. {
  79. ll a,b;
  80. scanf("%lld %lld",&a,&b);
  81. ll x=(a+b);
  82. // cout<<"Case #"<<++test<<": ";
  83. cout<<convertDecimalToBinary(x)<<endl;
  84. return 0;
  85. }
  86.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
1
15 4
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:85:1: error: expected ‘}’ at end of input
 }
 ^
stdout
Standard output is empty