#include <bits/stdc++.h>
using namespace std;
void invert(long long num)
{
long long x = log2(num) + 1;
for (long long i = 0; i < x; i++)
num = (num ^ (1 << i));
cout << num;
}
int main()
{
long long num ;
cin >> num;
invert(num);
return 0;
}
Rezolvare de 90 de puncte. Nu stiu ce imi scapa, poate gasesti tu. Succes!