标签:sum nbsp rip += cpp esc php title clu
http://acm.hdu.edu.cn/showproblem.php?pid=2005
#include <bits/stdc++.h>
using namespace std;
int rn[15]= {0,31,29,31,30,31,30,31,31,30,31,30,31};
int pn[15]= {0,31,28,31,30,31,30,31,31,30,31,30,31};
int main()
{
int year,mon,day;
while(~scanf("%d/%d/%d",&year,&mon,&day))
{
int sum=0,res=0;
if((year%4==0&&year%100!=0)||year%400==0)
{
//cout<<"yes"<<endl;
for(int i=1; i<=mon; i++)
{
sum+=rn[i-1];
}
}
else
{
//cout<<"no"<<endl;
for(int i=1; i<=mon; i++)
{
sum+=pn[i-1];
}
}
res=sum+day;
//cout<<rn[1]<<endl;
printf("%d\n",res);
}
return 0;
}
标签:sum nbsp rip += cpp esc php title clu
原文地址:https://www.cnblogs.com/zlrrrr/p/9321151.html