problem

1154. Day of the Year

solution

class Solution {
public:
int dayOfYear(string date) {
// 平年 闰年
int days[] = {, , , , , , , , , , , };
int y = stoi(date.substr(, )), m = stoi(date.substr(, )), d = stoi(date.substr());
if(m> && y % == && (y % != || y % == )) d++;//leap year..errr..
while(--m) d += days[m-];//errr..
return d;
}
};

参考

1. Leetcode_easy_1154. Day of the Year;

【Leetcode_easy】1154. Day of the Year的更多相关文章

  1. 【Leetcode_easy】1021. Remove Outermost Parentheses

    problem 1021. Remove Outermost Parentheses 参考 1. Leetcode_easy_1021. Remove Outermost Parentheses; 完

  2. 【Leetcode_easy】1022. Sum of Root To Leaf Binary Numbers

    problem 1022. Sum of Root To Leaf Binary Numbers 参考 1. Leetcode_easy_1022. Sum of Root To Leaf Binar ...

  3. 【Leetcode_easy】1025. Divisor Game

    problem 1025. Divisor Game 参考 1. Leetcode_easy_1025. Divisor Game; 完

  4. 【Leetcode_easy】1029. Two City Scheduling

    problem 1029. Two City Scheduling 参考 1. Leetcode_easy_1029. Two City Scheduling; 完

  5. 【Leetcode_easy】1030. Matrix Cells in Distance Order

    problem 1030. Matrix Cells in Distance Order 参考 1. Leetcode_easy_1030. Matrix Cells in Distance Orde ...

  6. 【Leetcode_easy】1033. Moving Stones Until Consecutive

    problem 1033. Moving Stones Until Consecutive 参考 1. Leetcode_easy_1033. Moving Stones Until Consecut ...

  7. 【Leetcode_easy】1037. Valid Boomerang

    problem 1037. Valid Boomerang 参考 1. Leetcode_easy_1037. Valid Boomerang; 完

  8. 【Leetcode_easy】1042. Flower Planting With No Adjacent

    problem 1042. Flower Planting With No Adjacent 参考 1. Leetcode_easy_1042. Flower Planting With No Adj ...

  9. 【Leetcode_easy】1046. Last Stone Weight

    problem 1046. Last Stone Weight 参考 1. Leetcode_easy_1046. Last Stone Weight; 完

随机推荐

  1. __try __except与__try __finally的嵌套使用以及__finally的调用时机

    原文:https://blog.csdn.net/SwordArcher/article/details/82465522 try-finally语句的语法与try-except很类似,稍有不同的是, ...

  2. mysqli扩展有一系列的优势,相对于mysql扩展的提升主要优势有哪些?

    mysqli扩展有一系列的优势,相对于mysql扩展的提升主要优势有哪些? 面向对象接口 prepared语句支持(译注:关于prepare请参阅mysql相关文档) 多语句执行支持 事务支持 增强的 ...

  3. 【概率论】6-1:大样本介绍(Large Random Samples Introduction)

    title: [概率论]6-1:大样本介绍(Large Random Samples Introduction) categories: - Mathematic - Probability keyw ...

  4. 2019.10.25字符串——zr

    题意: 给你两个字符串,由01组成:求他们两个的最短公共非子序列,要求字典序最小: 非公共子序列:都不是这两个字符串的子序列: 本人只会暴力啊,二进制枚举稳拿15分: 然而这道题其实是一个最短路题: ...

  5. 在Typora中使用Latex

    https://blog.csdn.net/happyday_d/article/details/83715440 今后可能更多在本地编辑出Markdown之后复制上博客或者上传到GitHub.

  6. 【CSP模拟赛】天才绅士少女助手克里斯蒂娜(线段树&读入优化&输出优化)

    题面描述 红莉栖想要弄清楚楼下天王寺大叔的显像管电视对“电话微波炉(暂定)”的影响.选取显像管的任意一个平面,一开始平面内有个n电子,初始速度分别为vi,定义飘升系数为 $$\sum_{1\leqsl ...

  7. java非空判断

    是否为 null 是否为 "" 是否为空字符串(引号中间有空格)  如: "     ". 制表符.换行符.换页符和回车 一. 字符串 1. if(str == ...

  8. SQL中的xp_cmdshell拒绝访问

    数据库备份作业的sql,,最后一步删除指定时间之前的文件夹.. 使用 xp_cmdshell 函数调用  RMDIR 命令删除过期文件夹,但返回拒绝访问.. 代码如下: DECLARE @PATH2 ...

  9. 利用JDK方式和GuavaAPI方式实现观察者模式

    1.JDK方法实现案例需求: 去餐厅吃饭有时候需要排队,进行排队叫号.假如所有等待的人都是观察者,叫号系统就是一个被监听的主题对象.当叫号系统发出叫号通知后,所有等待的人,都会收到通知,然后检查自己的 ...

  10. 深度学习面试题10:二维卷积(Full卷积、Same卷积、Valid卷积、带深度的二维卷积)

    目录 二维Full卷积 二维Same卷积 二维Valid卷积 三种卷积类型的关系 具备深度的二维卷积 具备深度的张量与多个卷积核的卷积 参考资料 二维卷积的原理和一维卷积类似,也有full卷积.sam ...