Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
139897 胡海峰老师 09闰年第n个月有多少天 C++ Accepted 0 MS 280 KB 649 2025-12-11 15:17:46

Tests(10/10):


Code:

#include <iostream> //designed by hu 2025-10 using namespace std; int main(){ //Month( 4,6,9,11)----> 30 Days //Month( 2 )----> 29 Days //Month( 1,3,5,7,8,10,12)----> 30 Days int n; // 1- 12(valid合法) ,不在这个区间(invalid 非法) cin >> n; //从键盘输入一个月份 if( n==2) { cout << 29; } else if( n==4 ) { cout << 30; } else if( n==6 ) { cout << 30; } else if( n==9 ) { cout << 30; } else if( n==11 ) { cout << 30; } else if( n<1 || n>12 ) { cout << "Invalid."; } else{ cout << 31; } return 0; }