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. git分支相关的命令

    Git 分支管理及结合gitlab的使用 说明有关gitlab的说明及基本操作,请参考:https://blog.51cto.com/wutengfei/2090253使用git分支的作用,我们先来说 ...

  2. linux ps命令查看最消耗CPU、内存的进程

    1.CPU占用最多的前10个进程: ps auxw|head -1;ps auxw|sort -rn -k3|head -10 2.内存消耗最多的前10个进程 ps auxw|head -1;ps a ...

  3. vue中插槽作用域的使用

    一.插槽作用域 1.简单来说就是带参数的插槽: 2.使用方式: 在组件标签内部加一个template标签 在template标签上加一个属性scope 值随意书写 在组件内部用slot进行接受,如果给 ...

  4. Mybatis-Plus 3.0

    https://www.cnblogs.com/limn/p/9923170.html   代码生成器 https://blog.csdn.net/penker_zhao/article/detail ...

  5. strutsCRUD

    Bookdao public class BookDao extends JsonBaseDao{ //分页查询书本信息 //根据书本id查询当个书本信息 public List<Map< ...

  6. cube.js 学习(七)cube.js type 以及format 说明

      cube.js 对于measure以及dimension 提供了丰富的数据类型,基本满足我们常见应用的开发,同时对于不同类型也提供了 格式化的操作 measure类型 number 格式 purc ...

  7. ico图标和制作网站(比特虫)

    1.怎么找到网站的图标: 网址/favicon.ico 代码引入 <link rel="icon" href="//www.jd.com/favicon.ico&q ...

  8. AttributeError: module 'tensorflow' has no attribute 'set_random_seed'

    anaconda3 python3.7 安装好tensorflow 后出现上面的问题,原因是安装的tensorflow版本是2.0的,所以使用以前的代码tensorflow中的函数不兼容.

  9. Note_4.7

    2019/4/7 奇奇怪怪的笔记 狄利克雷卷积  \(μ∗1=ϵ\),莫比乌斯反演 \(Id=φ∗1⇒φ=μ∗Id\) \(d=1∗1⇒1=μ∗d\) \(σ=Id∗1⇒Id=μ∗σ\) \(σ=φ∗ ...

  10. BDD本质及与ATDD区别

    说起BDD,你会想到什么?   在刚接触BDD(Behavior Driven Development,行为驱动开发)的时候,我以为就是用Cucumber这样的工具来编写场景用例,从而实现自动化测试, ...