提交时间:2024-11-17 17:14:59

运行 ID: 56960

#include <bits/stdc++.h> using namespace std; int days[13] = {0,31,28,31,30,31,30,31,31,30,31,30,31}; int f(int y) { return y%4==0 && y%100!=0 || y%400==0; } int main() { int n, y=1999, m=4, d=30; cin>>n; days[2]+=f(y); for(int i=2;i<=n;i++) { d++; if(d>days[m]) { d=1; m++; if(m>12) { y++; m=1; if(f(y)==1) days[2]=29; else days[2]=28; } } } printf("%d-%02d-%02d",y,m,d); return 0; }//int main() { #include<bits/stdc++.h>