#include<bits/stdc++.h> using namespace std; int main(){ int y,m,d; bool flag=false; cin>>y>>m>>d; if(y%4==0&&y%100!=0||y%400==0){ flag=true; } int month[12]={31,28,31,30,31,30,31,31,30,31,30,31}; int sumday=0; for(int i=0;i<m-1;i++){ sumday+=month[i]; } if(flag==true){ cout<<sumday+1+d; } else{ cout<<sumday+d; } return 0; } |
Double click to view unformatted code.