Run ID 作者 问题 语言 测评结果 时间 内存 代码长度 提交时间
42496 老方 推算 C++ 通过 0 MS 244 KB 610 2024-02-29 17:26:53

Tests(1/1):


#include<bits/stdc++.h> using namespace std; int y=1999,m=4,d=30,n; int ts(int a){ if(a==1||a==3||a==5||a==7||a==8||a==10||a==12)return 31; else if(a==4||a==6||a==9||a==11)return 30; else if(y%4==0||y%100!=0&&y%400==0)return 29; else return 28; } int main(){ cin>>n; while(n>=366){ if(y%4==0||y%100!=0&&y%400==0){ n-=366; }else{ n-=365; } y++; } while(n>=31){ n-=ts(m); m++; } while(n){ if(d==ts(m)+1){ d=1; m++; }else{ d++; } n--; } cout<<y<<'-'; if(m<10)cout<<'0'; cout<<m<<'-'; if(d<10)cout<<'0'; cout<<d; return 0; }


测评信息: