标签:otto lin cpp family == printf pac ros pos
#include<stdio.h> int m,n; int month[]={0,31,28,31,30,31,30,31,31,30,31,30,31}; int isLeapYear(int y){ if((y%4==0&&y%100!=0)||y%400==0) { return 1; } else return 0; } void solve() { int i=1; while(n>month[i]) { n-=month[i]; i++; } printf("%04d-%02d-%02d\n",m,i,n); } int main(int argc, char *argv[]) { while(~scanf("%d%d",&m,&n)) { if(isLeapYear(m)){ month[2]++; solve(); month[2]--; } else solve(); } return 0; }
注意输出格式的问题
标签:otto lin cpp family == printf pac ros pos
原文地址:http://www.cnblogs.com/mfmdaoyou/p/6696467.html