2 条题解
-
312338黄浩洋 (12338黄浩洋) LV 8 @ 2022-03-01 12:42:41
#include<bits/stdc++.h>
using namespace std;
int main()
{
long long i=0,y,m,d,leap=0;
cin>>y>>m>>d;
switch(m)
{
case 1:leap=0;break;
case 2:leap=leap+31;break;
case 3:leap=leap+59;break;
case 4:leap=leap+90;break;
case 5:leap=leap+120;break;
case 6:leap=leap+151;break;
case 7:leap=leap+181;break;
case 8:leap=leap+212;break;
case 9:leap=leap+243;break;
case 10:leap=leap+273;break;
case 11:leap=leap+304;break;
case 12:leap=leap+334;break;
}
if(y%4==0&&y%100!=0||y%400==0)
leap++;
cout<<leap+d<<endl;
return 0;
} -
12024-02-20 13:31:25@
#include<bits/stdc++.h>
using namespace std;
int a,b,c;
bool y(int i)
{
if((i%4==0&&i%100!=0)||i%400==0)
return true;
return false;
}
int mon(int a,int b)
{
if(b==1||b==3||b==5||b==7||b==8||b==10||b==12)return 31;
else if(b==2)
{
if((a%4==0&&a%100!=0)||a%400==0)
{
return 29;
}
return 28;
}
else return 30;
}
int g(int a,int b,int c)
{
int ans=0;
if(b==1)ans=c;
else
{
for(int i=1;i<b;i++)
ans+=mon(a,i);
ans+=c;
}
return ans;
}
int main()
{
cin>>a>>b>>c;
cout<<g(a,b,c);
return 0;
}
- 1
信息
- ID
- 1029
- 难度
- 2
- 分类
- (无)
- 标签
- 递交数
- 135
- 已通过
- 80
- 通过率
- 59%
- 上传者