1 条题解
-
0
C++ :
#include<iostream> using namespace std; int main() { int year,month; cin>>year>>month; switch(month) { case 1: case 3: case 5: case 7: case 8: case 10: case 12:cout<<31<<endl;break; case 4: case 6: case 9: case 11:cout<<30<<endl;break; case 2: if((year%4==0 && year%100!=0) || year%400==0) { cout<<29<<endl;break; } else { cout<<28<<endl;break; } } return 0; }
Pascal :
var month,year:integer;b:boolean; begin readln(year,month); b:=false; if (year mod 4=0)and(year mod 100<>0)or(year mod 400=0) then b:=true; case month of 1,3,5,7,8,10,12:writeln(31); 4,6,9,11:writeln(30); 2:if b then writeln(29)else writeln(28); end; end.
- 1
信息
- ID
- 965
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- (无)
- 标签
- 递交数
- 0
- 已通过
- 0
- 上传者