1 solutions
-
0
C++ :
#include<bits/stdc++.h> using namespace std; int run(int x) { return (x%100==0&&x%400==0)||(x%100!=0&&x%4==0); } int n,m; int main() { cin>>n>>m; int s=0; if(run(n))s=1; switch(m) { case 1:cout<<31;break; case 2:cout<<28+s;break; case 3:cout<<31;break; case 4:cout<<30;break; case 5:cout<<31;break; case 6:cout<<30;break; case 7:cout<<31;break; case 8:cout<<31;break; case 9:cout<<30;break; case 10:cout<<31;break; case 11:cout<<30;break; case 12:cout<<31;break; } return 0; }Pascal :
program es5; var a,b,c:integer; begin readln(a,b); if b=1 then c:=31; if b=3 then c:=31; if b=5 then c:=31; if b=7 then c:=31; if b=8 then c:=31; if b=10 then c:=31; if b=12 then c:=31; if b=4 then c:=30; if b=6 then c:=30; if b=9 then c:=30; if b=11 then c:=30; if b=2 then if (a mod 4=0)and(a mod 100<>0) or (a mod 400=0) then c:=29 else c:=28; writeln(c); end.
- 1
Information
- ID
- 17361
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By