0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-27 21:16:27 +00:00

P5690 [CSP-SJX2019]日期

R43070409
This commit is contained in:
Baoshuo Ren 2020-12-03 08:45:16 +08:00 committed by Baoshuo Ren
parent 8366ed437a
commit 4f642b2ffc
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68

49
problem/P5690/P5690.cpp Normal file
View File

@ -0,0 +1,49 @@
#include <bits/stdc++.h>
using namespace std;
int main() {
int m, d, t, ans = 0;
scanf("%d-%d", &m, &d);
if (1 <= m && m <= 12) {
if (m == 1 || m == 3 || m == 5 || m == 7 || m == 8 || m == 10 || m == 12) {
t = 31;
}
else if (m == 2) {
t = 28;
}
else {
t = 30;
}
if (1 <= d && d <= t) {
ans = 0;
}
else {
ans = 1;
}
}
else if (12 < m && m < 20) {
if (1 <= d && d <= 31) {
ans = 1;
}
else {
ans = 2;
}
}
else {
if (m % 10 == 1 || m % 10 == 2 || m % 10 == 3 || m % 10 == 5 || m % 10 == 7 || m % 10 == 8) {
t = 31;
}
else {
t = 30;
}
if (1 <= d && d <= t) {
ans = 1;
}
else {
ans = 2;
}
}
printf("%d\n", ans);
return 0;
}