fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int math(int b) {
  5. return (((((b + 1) + 4) / 2) & b) << 2);
  6. }
  7.  
  8. int main() {
  9. for (int i = 1; i <= 20; i++) {
  10. cout << i << ": " << math(i) << '\n';
  11. }
  12. }
Success #stdin #stdout 0s 4240KB
stdin
Standard input is empty
stdout
1: 4
2: 8
3: 0
4: 16
5: 20
6: 16
7: 24
8: 0
9: 4
10: 8
11: 32
12: 32
13: 36
14: 32
15: 40
16: 0
17: 4
18: 8
19: 0
20: 16