fork download
  1. #include <iostream>
  2. #include <bitset>
  3.  
  4. int main() {
  5. // your code goes here
  6. int max = 2147483647;
  7. int sum = max + max;
  8. long long sum_l = (long long)max + max;
  9.  
  10. std::cout << max << " = " << std::bitset<64>(max) << std::endl;
  11. std::cout << sum << " = " << std::bitset<64>(sum) << std::endl;
  12. std::cout << sum_l << " = " << std::bitset<64>(sum_l) << std::endl;
  13.  
  14. return 0;
  15. }
Success #stdin #stdout 0s 3416KB
stdin
Standard input is empty
stdout
2147483647 = 0000000000000000000000000000000001111111111111111111111111111111
-2 = 0000000000000000000000000000000011111111111111111111111111111110
4294967294 = 0000000000000000000000000000000011111111111111111111111111111110