第几天 AC 杭电
第几天?
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 90652 Accepted Submission(s): 34083
Problem Description
给定一个日期,输出这个日期是该年的第几天。
Input
输入数据有多组,每组占一行,数据格式为YYYY/MM/DD组成,具体参见sample input ,另外,可以向你确保所有的输入数据是合法的。
Output
对于每组输入数据,输出一行,表示该日期是该年的第几天。
Sample Input
1985/1/20
2006/3/12
Sample Output
20
71
Author
lcy
Source
C语言程序设计练习(一)
#include<stdio.h>
int main()
{
int Y,M,D,e;
while(scanf("%d/%d/%d",&Y,&M,&D)!=EOF)
{
if(M==1)
e=D;
else if(M==2)
e=31+D;
else if(M==3)
e=59+D;
else if(M==4)
e=90+D;
else if(M==5)
e=120+D;
else if(M==6)
e=151+D;
else if(M==7)
e=181+D;
else if(M==8)
e=212+D;
else if(M==9)
e=242+D;
else if(M==10)
e=273+D;
else if(M==11)
e=303+D;
else if(M==12)
e=334+D;
if(M>2)
{
if((Y%4==0&&Y%100!=0)||(Y%400==0))
printf("%d\n",e+1);
else
printf("%d\n",e);
}
else printf("%d\n",e);
}
}
第几天 AC 杭电的更多相关文章
- 2015 偶数求和 AC 杭电
偶数求和 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submi ...
- 蟠桃记 AC 杭电
蟠桃记 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submis ...
- 素数判定 AC 杭电
素数判定 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submi ...
- 多项式求和 AC 杭电
多项式求和 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Subm ...
- 水仙花 AC 杭电
水仙花数 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submi ...
- 求数列的和 AC 杭电
求数列的和 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Subm ...
- 数值统计 AC 杭电
数值统计 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submi ...
- 平方和与立方和 AC 杭电
平方和与立方和 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Su ...
- 求奇数的乘积 AC 杭电
求奇数的乘积 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Sub ...
随机推荐
- 怎么都没人提 google 加密搜索呢? google如何稳定打开
1. 使用smarthosts提供的hosts文件 https://smarthosts.googlecode.com/svn/trunk/hosts2. 修改浏览器默认搜索引擎为 https://e ...
- Resizable 2th click not working
here's a simple solution. just destroy the resizable function, then rebuild it. try { $("#div& ...
- HttpClient封装
package com.exmyth.net; public interface KeyLoadListener { public void onSuccess(byte[] key); // pub ...
- Project Euler:Problem 47 Distinct primes factors
The first two consecutive numbers to have two distinct prime factors are: 14 = 2 × 7 15 = 3 × 5 The ...
- C primer plus 读书笔记第二章
这章的标题是C语言概述,内容大概是介绍一些简单的示例程序,来了解和熟悉C语言的一些基本特征. 这是书里的第一段代码,敲敲找找感觉.推荐在linux环境下写代码. PS:倒腾sublime text一下 ...
- Python标准库:内置函数bytearray([source[, encoding[, errors]]])
返回一个新字节数组.这个数组里的元素是可变的.而且每一个元素的值范围: 0 <= x < 256.能够通过"字节与字节数组操作"章节来查看相关字节数组的内容.以下说明一 ...
- [CSS3 + HTML5] Modernizr
Modernizr is a library for detecting whether the user's browsers have certain features and based on ...
- jboss7 加载module过程
1. 调试类: org.jboss.as.server.Main的main方法 断点: Module.registerURLStreamHandlerFactoryModule(Module.getB ...
- POJ 1556 The Doors 线段判交+Dijkstra
The Doors Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 6734 Accepted: 2670 Descrip ...
- mongodb入门教程
title: mongodb入门教程 date: 2016-04-06 14:47:18 tags: --- 为什么要认识呢,因为这玩意就一傻逼 借用一下百科的介绍 MongoDB 是一个介于关系数据 ...