3 条题解
-
1240915cjb周思源 (周思源) LV 8 @ 2024-07-14 12:06:44
#include<bits/stdc++.h>
using namespace std;
int main()
{
int y,m,d,sum=0,leap=0;
cin>>y>>m>>d;
if(y%4==0&&y%100!=0||y%400==0)
leap=1;
for(int i=2;i<=m;i++)
{
if(i==3||i==5||i==7||i==8||i==10||i==12)
sum+=31;
if(i==4||i==6||i==9||i==11)
sum+=30;
if(i==2)
sum=28+leap;
}
cout<<sum+d;
return 0;
} -
12023-05-11 23:33:05@
#include<bits/stdc++.h>
using namespace std;
int main()
{
int y,m,d,sum=0,leap=0;
cin>>y>>m>>d;
if(y%4==0&&y%100!=0||y%400==0)
leap=1;
for(int i=2;i<=m;i++)
{
if(i==3||i==5||i==7||i==8||i==10||i==12)
sum+=31;
if(i==4||i==6||i==9||i==11)
sum+=30;
if(i==2)
sum=28+leap;
}
cout<<sum+d;
return 0;
}//正确题解 -
12022-08-23 18:45:13@
#include<bits/stdc++.h> using namespace std; int main() { int y,m,d; cin>>y>>m>>d; if(m==1) { cout<<d; } if(m==2) { cout<<d+31; } if(m==3) { if(y%4==0&&y%100!=0||y%400==0) cout<<d+29+31; else cout<<d+28+31; } if(m==4) { if(y%4==0&&y%100!=0||y%400==0) cout<<d+29+31+31; else cout<<d+28+31+31; } if(m==5) { if(y%4==0&&y%100!=0||y%400==0) cout<<d+29+31+31+30; else cout<<d+28+31+31+30; } if(m==6) { if(y%4==0&&y%100!=0||y%400==0) cout<<d+29+31+31+30+31; else cout<<d+28+31+31+30+31; } if(m==7) { if(y%4==0&&y%100!=0||y%400==0) cout<<d+29+31+31+30+31+30; else cout<<d+28+31+31+30+31+30; } if(m==8) { if(y%4==0&&y%100!=0||y%400==0) cout<<d+29+31+31+30+31+30+31; else cout<<d+28+31+31+30+31+30+31; } if(m==9) { if(y%4==0&&y%100!=0||y%400==0) cout<<d+29+31+31+30+31+30+31+31; else cout<<d+28+31+31+30+31+30+31+31; } if(m==10) { if(y%4==0&&y%100!=0||y%400==0) cout<<d+29+31+31+30+31+30+31+31+30; else cout<<d+28+31+31+30+31+30+31+31+30; } if(m==11) { if(y%4==0&&y%100!=0||y%400==0) cout<<d+29+31+31+30+31+30+31+30+31+31; else cout<<d+28+31+31+30+31+30+31+30+31+31; } if(m==12) { if(y%4==0&&y%100!=0||y%400==0) cout<<d+29+31+31+30+31+30+31+30+31+30+31; else cout<<d+28+31+31+30+31+30+31+30+31+30+31; } return 0; } //我是小牛逼,越来越牛逼!
- 1
信息
- ID
- 1030
- 难度
- 1
- 分类
- (无)
- 标签
- 递交数
- 79
- 已通过
- 56
- 通过率
- 71%
- 上传者