网站建设推广哪个好,商城网站开发报价,大连短视频代运营,假网站怎么做★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★➤微信公众号#xff1a;山青咏芝#xff08;shanqingyongzhi#xff09;➤博客园地址#xff1a;山青咏芝#xff08;https://www.cnblogs.com/strengthen/#xff09;➤GitHub地址山青咏芝shanqingyongzhi➤博客园地址山青咏芝https://www.cnblogs.com/strengthen/➤GitHub地址https://github.com/strengthen/LeetCode➤原文地址https://www.cnblogs.com/strengthen/p/11179554.html ➤如果链接不是山青咏芝的博客园地址则可能是爬取作者的文章。➤原文已修改更新强烈建议点击原文地址阅读支持作者支持原创★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★ Given a year Y and a month M, return how many days there are in that month. Example 1: Input: Y 1992, M 7
Output: 31Example 2: Input: Y 2000, M 2
Output: 29Example 3: Input: Y 1900, M 2
Output: 28 Note: 1583 Y 21001 M 12指定年份 Y 和月份 M请你帮忙计算出该月一共有多少天。 示例 1 输入Y 1992, M 7
输出31示例 2 输入Y 2000, M 2
输出29示例 3 输入Y 1900, M 2
输出28 提示 1583 Y 21001 M 124ms 1 class Solution {2 func numberOfDays(_ Y: Int, _ M: Int) - Int {3 if Y % 400 0 || (Y % 100 ! 0 Y % 4 0)4 {5 if M 2 {return 29}6 }7 let mon:[Int] [31,28,31,30,31,30,31,31,30,31,30,31]8 return mon[M - 1]9 }
10 } 转载于:https://www.cnblogs.com/strengthen/p/11179554.html