fork(5) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int getMonth(int m, int y) {
  5. return 31-(102/m&1)-((4/m&2)>>((!y%4)-(!y%100)+(!y%400)));
  6. }
  7.  
  8. int main() {
  9. // your code goes here
  10. for (int i = 1; i <= 12; i++) {
  11. cout << getMonth(i, 1996) << " ";
  12. }
  13.  
  14. return 0;
  15. }
Success #stdin #stdout 0s 3140KB
stdin
Standard input is empty
stdout
31 28 31 30 31 30 31 31 30 31 30 31