萌新刚学分支,求助
查看原帖
萌新刚学分支,求助
677581
_Glassy_Sky_楼主2023/8/27 20:53
#include<bits/stdc++.h>
using namespace std;
const int a[] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
const int b[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int main()
{
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);
	ios::sync_with_stdio(0);
	cin.tie(0), cout.tie(0);
	int n, m;
	cin >> n >> m;
	if(n % 10 == 0 && n % 100 / 10 == 0 && m == 2)
		cout << a[m];
	else if(n % 4 == 0 && m == 2)
		cout << a[m];
	else
		cout << b[m];
	return 0;
}

2023/8/27 20:53
加载中...