【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; 完
随机推荐
- 上传图片,点击触发隐藏得file
编辑一个div 将其宽高设定好 给其背景颜色 div class="form-group"> <label class="col-sm-2 control ...
- WebAPI学习
WebAPI概述 今天的web计算平台包含了广泛的功能,其中的大部分均可以通过API(应用程序编程接口)访问. web平台归为6个基本设施,都会用到webapi,包括存储服务.消息服务.计算服务.信息 ...
- 洛谷 P1842 奶牛玩杂技 题解
P1842 奶牛玩杂技 题目背景 Farmer John 养了N(1<=N<=50,000)头牛,她们已经按1~N依次编上了号.FJ所不知道的是,他的所有牛都梦想着从农场逃走,去参加马戏团 ...
- yii2.0简单使用elasticsearch
1.安装扩展 /c/phpStudy/PHPTutorial/php/php-5.5.38/php /c/ProgramData/ComposerSetup/bin/composer.phar req ...
- org.apache.ibatis.cache.CacheException: Error serializing object
异常: 十二月 26, 2017 3:38:05 下午 org.apache.jasper.servlet.TldScanner scanJars 信息: At least one JAR was s ...
- D2. Remove the Substring (hard version)(思维 )
D2. Remove the Substring (hard version) time limit per test 2 seconds memory limit per test 256 mega ...
- 【洛谷】P4167 [Violet]樱花
题面 又懒得弄题面,开个传送门吧 分析 人生第一次切数学题,我们先把方程写出来 $$\frac {1}{x}+\frac {1}{y}=\frac {1}{n!}$$ 现在我们知道的条件是x,y都是正 ...
- boosting与随机森林
本文原创,转载请注明出处 http://www.cnblogs.com/gufeiyang 本文主要分两部分,boosting 与 随机森林. “三个臭皮匠顶一个诸葛亮”是说三个不聪明的人集合在一 ...
- redis 业务锁 not exist 模式
背景: 业务核心模块只能提交一次,原实现方案 前端加提交限制.后端加数据库业务逻辑判定,结果失效,api站点部署多台负载,切方法需要强求第三方接口 响应时间较慢 ,故放弃lock. 解决方案:redi ...
- Tuxedo 介绍
快速阅读 介绍Tuxedo,以及webLogic两个中间件,都是oracle旗下的产品 ,现在各银行系统用的最多.因为有部分项目涉及,所以有必须弄清楚,明白 . 什么是Tuxedo 官方介绍:http ...