答案
2024-07-23 08:57:42
发布于:北京
11阅读
0回复
0点赞
#include <bits/stdc++.h>
using namespace std;
int a(int n, int m){
if(m == 1 || m == 3 || m == 5 || m == 7 || m == 8 || m == 10 || m == 12){
return 31;
}else if(m == 4 || m == 6 || m == 9 || m == 11){
return 30;
}else{
if(n % 4 == 0 && n % 100 != 0 || n % 400 == 0){
return 29;
}else{
return 28;
}
}
}
int main(){
int n, m;
cin >> n >> m;
cout << a(n, m);
return 0;
}
全部评论 2
AC!!
2024-07-23 来自 北京
0#include <bits/stdc++.h> using namespace std; int a(int n, int m){ if(m == 1 || m == 3 || m == 5 || m == 7 || m == 8 || m == 10 || m == 12){ return 31; }else if(m == 4 || m == 6 || m == 9 || m == 11){ return 30; }else{ if(n % 4 == 0 && n % 100 != 0 || n % 400 == 0){ return 29; }else{ return 28; } } } int main(){ int n, m; cin >> n >> m; cout << a(n, m); return 0; }
2024-07-23 来自 北京
0
有帮助,赞一个