题目描述
输入年份和月份,输出这一年的这一月有多少天。需要考虑闰年。
输入格式
输入两个正整数,分别表示年份 y 和月数 m,以空格隔开。
输出格式
输出一行一个正整数,表示这个月有多少天。
输入输出样输入 #1例 输出 #1
1926 8 31
第二个懒得输
嗨嗨嗨,时隔两年半我又来打卡了!!!
最近比赛太多了啊啊啊
上代码!!!!!!!!!
#include<iostream>
using namespace std;
int main()
{
int i,n;
cin>>i>>n;
if(i/4==0)
{
if(n==1||3||5||7||8||10||12) cout<<"31"<<endl;
else if(n==2) cout<<"29"<<endl;
else cout<<"30"<<endl;
}
else if(i%100==0&&i%400==0)
{
if(n==1||3||5||7||8||10||12) cout<<"31"<<endl;
else if(n==2) cout<<"29"<<endl;
else cout<<"30"<<endl;
}
else
{
if(n==1||3||5||7||8||10||12) cout<<"31"<<endl;
else if(n==2) cout<<"28"<<endl;
else cout<<"30"<<endl;
}
}
好吧,我承认我只会判断
其实是懒得动脑
好了,还不一件三连?今天天就到这了,散会!!!