Files
python/TangDou/XiTi/1339.cpp
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

30 lines
620 B
C++

#include <bits/stdc++.h>
using namespace std;
int main() {
int y, d;
cin >> y >> d;
int a[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
//是不是闰年
if ((y % 4 == 0 && y % 100 != 0) || y % 400 == 0) {
a[1] = 29;
}
int temp = 0;
if (d < a[0]) {
cout << 1 << endl;
cout << d << endl;
}
for (int i = 0; i < 12; i++) {
temp += a[i];
if (temp > d) {
cout << i+1 << endl;
temp -= a[i];
cout << d - temp << endl;
break;
}
}
return 0;
}