1 条题解
-
0
cpp
#include<iostream> using namespace std; const int N=13; bool isleap(int n) { if(n%4==0&&n%100!=0||n%400==0) return true; else return false; } int main() { int year,month,day;cin>>year>>month>>day; int a[N]={0,31,28,31,30,31,30,31,31,30,31,30,31}; if(isleap(year)==true) a[2]=29; int x;cin>>x; while(x!=0) { day++; if(day>a[month]){ day=1; month++; } if(month>12){ month=1; year++; if(isleap(year)==true) a[2]=29; else a[2]=28; } x--; } cout<<year<<" "<<month<<" "<<day; return 0; }
- 1
信息
- ID
- 143
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 10
- 标签
- 递交数
- 2
- 已通过
- 2
- 上传者