于墨轩 • 27天前
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
if (n < 1 || n > 12) {
cout << "Invalid." << endl;
return 0;
}
const int leap_year_days[] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
cout << leap_year_days[n] << endl;
return 0;
}
评论: