文章
55
粉丝
100
获赞
12
访问
31.1k
#include<stdio.h>
#include<iostream>
using namespace std;
int main(){
int year,n;
while(cin>>year>>n){
int arr[13] = {0,31,28,31,30,31,30,31,31,30,31,30,31};
bool isLeap = year%400==0 || year%100!=0 && year%4==0;
if(isLeap){
arr[2] = 29;
}
int month = 1;
int t = 0;
for(int i = 1; i<=n; i++){
if(i > arr[month]){
i = 1;
n-=arr[month];
month++;
}
t = i;
}
if(month<10 && t<10){
printf("%d-0%d-0%d\n",year,month,t);
}else if(month<10){
printf("%d-0%d-%d\n",year,month,t);
}else if(t<10){
printf("%d-%d-0%d\n",year,month,t);
}else{
printf("%d-%d-%d\n",year,month,t);
}
}
}
登录后发布评论
暂无评论,来抢沙发