hdoj_2005 第几天?

来源:互联网 发布:用c语言打印出一个心形 编辑:程序博客网 时间:2024/05/21 17:15

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2005

 

//C++代码#include<iostream>using namespace std;int main(){int y,m,d;const int a[12]={0,31,59,90,120,151,181,212,243,273,304,334};char ch;while(cin>>y>>ch>>m>>ch>>d){int ans=a[m-1];ans+=d;if(((y%4==0 && y%100!=0) || y%400==0) && m>2) ans++;cout<<ans<<endl;}return 0;}


 

原创粉丝点击