#include <iostream> using namespace std; int main() { int year = 0; int month[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; int mon = 0; int day = 0; while (cin>>year>>mon) { if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) { if (mon == 2) { cout << "29" << endl; } else { cout << month[mon-1] << endl; } } else { cout << month[mon-1] << endl; } } system("pause"); return 0; }