B3835 [GESP202303 一级] 每月天数
yubowen0701 · · 题解
看到这一题很多dalao没做出来,本蒟蒻写了一篇,大佬勿喷
#include <bits/stdc++.h>
using namespace std;
int main (){
int A, B;
cin >> A >> B;
if (B == 1 || B == 3 || B == 5 || B == 7 || B == 8 || B == 10 || B == 12)
{
cout << "31";
return 0;
}
if (B == 4 || B == 6 || B == 9 || B == 11)
{
cout << "30";
return 0;
}
if (A % 4 == 0 && A % 100 != 0 || A % 400 == 0) cout << "29";
else cout << "28";
return 0;
}