0
点赞
收藏
分享

微信扫一扫

【洛谷】P5716 【深基3.例9】月份天数

星巢文化 2022-01-20 阅读 34
c++

原题链接

P5716 【深基3.例9】月份天数

ac代码

#include <iostream> 
using namespace std;												
int a[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; //打表 
int main() {
	int year, month;
	cin >> year >> month; 
	
	if ((year % 4 == 0 && year % 100 != 0) || n % 400 == 0)
		a[2] = 29;//先变
		
	cout << a[month];//直接输出 
	return 0;		  
}
举报

相关推荐

0 条评论