Advertisement
vlatkovski

Kalendar

Oct 7th, 2017
305
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.47 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5.     int m, g; cin >> m >> g;
  6.     set<int> d31 = {1, 3, 5, 7, 8, 10, 12};
  7.     set<int> d30 = {4, 6, 9, 11};
  8.     if (d31.find(m) != d31.end()) {
  9.         cout << 31;
  10.     }
  11.     else if (d30.find(m) != d30.end()) {
  12.         cout << 30;
  13.     }
  14.     else {//m=2
  15.         if (g % 400 == 0 || (g % 4 == 0 && g % 100 != 0)) {
  16.             cout << 29;
  17.         }
  18.         else {
  19.             cout << 28;
  20.         }
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement