LeetCode Biweekly Contest 4
問題文
省略
省略
#include<bits/stdc++.h>
using namespace std;
inline int isLeapYear(const int y){
if(y%4){
return 0;
}
if(y%100){
return 1;
}
if(y%400){
return 0;
}
return 1;
}
inline int numOfDaysInMonth(const int m){
if(m==2){
return 28;
}
if(m==4||m==6||m==9||m==11){
return 30;
}
return 31;
}
inline int numOfDaysInMonth(const int y, const int m){
if(m==2){
return numOfDaysInMonth(m)+ isLeapYear(y);
}
else{
return numOfDaysInMonth(m);
}
}
class Solution{
public:
int numberOfDays(int Y, int M){
return numOfDaysInMonth(Y,M);
}
}
;
// cLay varsion 20190714-1
// --- original code ---
// class Solution{
// public:
// int numberOfDays(int Y, int M){
// return numOfDaysInMonth(Y,M);
// }
// };
//
// {
// // main関数を適当に処理する
// }
Current time: 2024年04月26日01時31分28秒
Last modified: 2019年07月14日04時16分05秒 (by laycrs)
Tags: Competitive_Programming_Incomplete LeetCode
トップページに戻る
Logged in as: unknown user (not login)