hdu_2005_第几天?
来源:互联网 发布:linux开机自启动设置 编辑:程序博客网 时间:2024/06/09 17:06
http://acm.hdu.edu.cn/showproblem.php?pid=2005
第几天?
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 30000 Accepted Submission(s): 11576
Problem Description
给定一个日期,输出这个日期是该年的第几天。
Input
输入数据有多组,每组占一行,数据格式为YYYY/MM/DD组成,具体参见sample input ,另外,可以向你确保所有的输入数据是合法的。
Output
对于每组输入数据,输出一行,表示该日期是该年的第几天。
Sample Input
1985/1/202006/3/12
Sample Output
2071
- #include<iostream>
- using namespace std;
- int main()
- {
- int y,m,d,outn,flog,i;
- char c;
- while(cin>>y>>c>>m>>c>>d)
- {
- if(m==1)
- outn=d;
- else if(m==2)
- outn=31+d;
- else if(m>2&&m<8)
- {
- outn=31+28+d;
- flog=1;
- for(i=3;i<m;i++)
- {
- if(flog>0)
- {
- outn+=31;
- flog=-flog;
- }
- else
- {
- outn+=30;
- flog=-flog;
- }
- }
- }
- else if(m>7&&m<13)
- {
- outn=31+28+31+30+31+30+31+d;
- flog=1;
- for(i=8;i<m;i++)
- {
- if(flog>0)
- {
- outn+=31;
- flog=-flog;
- }
- else
- {
- outn+=30;
- flog=-flog;
- }
- }
- }
- if(((y%4==0)&&(y%100!=0)||(y%400==0))&&m>2)
- outn+=1;
- cout<<outn<<endl;
- }
- return 0;
- }
- hdu_2005_第几天?
- 第几天
- 【第几天?】
- 第几天?
- 第几天
- 第几天?
- 第几天
- 第几天
- 第几天?
- 第几天
- 第几天
- 第几天?
- 第几天
- 第几天?
- 第几天
- 第几天
- 第几天?
- 第几天?
- 8个用于图片展示的jQuery插件及教程推荐
- EBS 表后缀的含义
- hdu_2004_成绩转换
- njust 1420-线段树-3
- 视图编程指南之一 Cocoa 视图编程指南简介
- hdu_2005_第几天?
- 递归、内存的动态分配、指针
- java APPlet 绘制图像
- OpenNMS全接触-系统启动(四)
- Android中http交互是用HttpUrlConnection还是AndroidHttpClient好呢?
- Linux下sed命令使用
- hdu_2006_求奇数的乘积
- Spring2.0 AOP学习案例笔记
- 字符设备驱动数据结构之File_operations结构体