【Leetcode_easy】1154. Day of the Year
problem
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的更多相关文章
- 【Leetcode_easy】1021. Remove Outermost Parentheses
problem 1021. Remove Outermost Parentheses 参考 1. Leetcode_easy_1021. Remove Outermost Parentheses; 完
- 【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 ...
- 【Leetcode_easy】1025. Divisor Game
problem 1025. Divisor Game 参考 1. Leetcode_easy_1025. Divisor Game; 完
- 【Leetcode_easy】1029. Two City Scheduling
problem 1029. Two City Scheduling 参考 1. Leetcode_easy_1029. Two City Scheduling; 完
- 【Leetcode_easy】1030. Matrix Cells in Distance Order
problem 1030. Matrix Cells in Distance Order 参考 1. Leetcode_easy_1030. Matrix Cells in Distance Orde ...
- 【Leetcode_easy】1033. Moving Stones Until Consecutive
problem 1033. Moving Stones Until Consecutive 参考 1. Leetcode_easy_1033. Moving Stones Until Consecut ...
- 【Leetcode_easy】1037. Valid Boomerang
problem 1037. Valid Boomerang 参考 1. Leetcode_easy_1037. Valid Boomerang; 完
- 【Leetcode_easy】1042. Flower Planting With No Adjacent
problem 1042. Flower Planting With No Adjacent 参考 1. Leetcode_easy_1042. Flower Planting With No Adj ...
- 【Leetcode_easy】1046. Last Stone Weight
problem 1046. Last Stone Weight 参考 1. Leetcode_easy_1046. Last Stone Weight; 完
随机推荐
- Linux 数据库相关内核参数
cat >>/etc/sysctl.conf <<EOOF # add by digoal.zhou fs.aio-max-nr = 1048576 fs. ...
- Greenplum failed segment的恢复方法--primary与mirror都可修复
当在使用greenplum过程中有不当的操作时,可能会出现segment节点宕掉的情况(比如在greenplum运行的过程中停掉其中几台segment节点的服务器),通过下面的方法可以恢复segmen ...
- web实现大文件上传分片上传断点续传
需求:项目要支持大文件上传功能,经过讨论,初步将文件上传大小控制在500M内,因此自己需要在项目中进行文件上传部分的调整和配置,自己将大小都以501M来进行限制. 第一步: 前端修改 由于项目使用的是 ...
- DEV C++的使用
1.点击dev图标: 2.左上角点击:文件——新建——源代码(快捷键ctrl+N): 3. 然后开始写代码: 4.点击运行: 右边的那个编译加运行(点这个),左边编译,中间运行. 5.保存(可以修改保 ...
- (5)Go数组
数组 数组是同一种数据类型元素的集合. 在Go语言中,数组从声明时就确定,使用时可以修改数组成员,但是数组大小不可变化. 基本语法: // 定义一个长度为3元素类型为int的数组a var a [3] ...
- Mysql插入多条数据测试
--新建存储过程 create procedure doinsert3() begin declare i int; declare j int; set i = 0; set j = 0; whil ...
- エンジニア死滅シタ世界之高層ビル [MISSION LEVEL: B]-Python3
n = input() pre="" next_str = "" new_str = "" for i in range(int(n)): ...
- 设置windows service方式启动GitBlit
1.在Gitblit目录下,找到installService.cmd文件. 2.用记事本或者notepad++打开 2.1修改 ARCH 32位系统:SET ARCH=x86 64位系统:SET AR ...
- tail -f 加过滤功能
实时查看日志 通过-f参数,我们可以实时查看文件的新增内容: $ tail -f itbilu.log 注意:使用-f参数时不会中断文件监视,需要通过ctrl+c手动结束. 实时日志查看与grep过滤 ...
- npm install 时 No matching version found for react-flow-design@1.1.14
执行 npm install时报错如下: 4017 silly pacote range manifest for react-highcharts@^16.0.2 fetched in 19ms40 ...