杨逸 • 5个月前
using namespace std;
int main() {
int y, w;
cin >> y, cin >> w;
vector<int> month_days = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
vector<int> result;
int day_count = 0;
for (int m = 1; m < 13; m++) {
if (m > 1) {
day_count += month_days[m - 1];
}
day_count += 12;
int total_days = (day_count - 1) % 7;
int week_number = (total_days + w) % 7;
if (week_number == 5) {
result.push_back(m);
}
}
if (result.size() > 0) {
for (int i = 0; i < result.size(); i++) {
cout << result[i] << endl;
}
} else {
cout << "None" << endl;
}
return 0;
}
评论:
请先登录,才能进行评论