輸入包括兩個整數y(1<=y<=3000),n(1<=n<=366)。
可能有多組測試數據,對於每組數據, 按 yyyy-mm-dd的格式將輸入中對應的日期打印出來。
2000 3 2000 31 2000 40 2000 60 2000 61 2001 60
2000-01-03 2000-01-31 2000-02-09 2000-02-29 2000-03-01 2001-03-01
/* 程序設計思路:這是一道C題,哈哈。沒什麼技巧,按照題意去作就OK!這道題能夠變式爲給一個天數,求年月日和星期 */ #include<stdio.h> int a[13]={0,31,28,31,30,31,30,31,31,30,31,30,31}, b[13]={0,31,29,31,30,31,30,31,31,30,31,30,31}; int main(void){ int year,day,month; while(scanf("%d%d",&year,&day)!=EOF){ month=0; if(year%4==0&&year%100!=0||year%400==0) { while(day>b[month]) day-=b[month],month++; printf("%04d-%02d-%02d\n",year,month,day); } else { while(day>a[month]) day-=a[month],month++; printf("%04d-%02d-%02d\n",year,month,day); } } return 0; }