src2020/1651_daytoday/main.cpp

29 lines
521 B
C++

#include <iostream>
using namespace std;
int main()
{
int year ,month,day,ans=1,a[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
cin>>year>>month>>day;
ans+=year-1980;
if(month>3){
year++;
}
for(int i=1980;i<year;i+=4){
if(i%100!=0){
ans++;
}
if(i%400==0){
ans++;
}
}
for(int i=1;i<month;i++){
ans+=a[i];
}
ans+=day;
ans%=7;
if(ans==0){
ans=7;
}
cout<<ans;
}