ccf-201509-2

ccf-201509-2

#include <iostream>
using namespace std;
int main() {
    int year,day;
    cin>>year>>day;
    int a[]= {31,28,31,30,31,30,31,31,30,31,30,31};
    int b[]= {31,29,31,30,31,30,31,31,30,31,30,31};
    if(year%4==0&&year%100!=0||year%400==0) {
        int i=0;
        while(day>b[i]) {
            day-=b[i];
            i++;
            if(i>11) {
                break;
            }
        }
        cout<<i+1<<endl<<day;
    } else {
        int i=0;
        while(day>a[i]) {
            day-=a[i];
            i++;
            if(i>11) {
                break;
            }
        }
        cout<<i+1<<endl<<day;
    }
    return 0;
}

猜你喜欢

转载自blog.csdn.net/qq_36792042/article/details/82381381
今日推荐