#include<bits/stdc++.h> using namespace std; struct Date{ int year; int month; int day; }; int main(){ struct Date p; cin>>p.year>>p.month>>p.day; int a[12]={31,28,31,30,31,30,31,31,30,31,30,31}; int sum=p.day; for(int i=0;i<p.month-1;i++) sum+=a[i]; if(((p.year%4==0&&p.year%100!=0)||p.year%400==0)&&p.month>2) cout<<sum+1; else cout<<sum; return 0; } |
Double click to view unformatted code.