这题为什么不用数组呢?
原题链接:30023.有多少天呢?2026-06-30 12:38:26
发布于:湖北
用数组不香吗?
#include<iostream>
using namespace std;
int c[]={31,28,31,30,31,30,31,31,30,31,30,31};
int main(){
int a,b;
cin>>a>>b;
if(b==2&&a%4==0&&a%100!=0||a%400==0){
cout<<29;
}else{
cout<<c[b-1];
}
return 0;
}
明明数组更简单啊?
这里空空如也






















有帮助,赞一个