#include <iostream>
#include <string>
using namespace std;
int main(int argc, char const *argv[])
{
cout<<"N?"<<endl;
int n;
cin>>n;
int runyear[13] = {31,29,31,30,31,30,31,31,30,31,30,31};
int pingyear[13] = {31,28,31,30,31,30,31,31,30,31,30,31};
int count[7] = {0,0,0,0,0,0,0};
int nexttime = 1;
for(int i=1900;i<=1900+n-1;i++)
{
if(i%100==0)
if(i%400==0)
{
int sum = 0;
for(int j=0;j<12;j++)
{
int thirtenn = sum+13;
sum += runyear[j];
int result;
result = (thirtenn % 7 + nexttime - 1) % 7;
count[result]++;
}
nexttime = (366 % 7 + nexttime -1) % 7 + 1;
}
else
{
cout<<"first time"<<endl;
int sum = 0;
for(int j=0;j<12;j++)
{
int thirtenn = sum+13;
sum += pingyear[j];
int result;
result = (thirtenn % 7 + nexttime - 1) % 7;
count[result]++;
}
nexttime = (365 % 7 + nexttime -1) % 7 + 1;
}
else
if(i%4==0)
{
int sum = 0;
for(int j=0;j<12;j++)
{
int thirtenn = sum+13;
sum += runyear[j];
int result;
result = (thirtenn % 7 + nexttime - 1) % 7;
count[result]++;
}
nexttime = (366 % 7 + nexttime -1) % 7 + 1;
}
else
{
int sum = 0;
for(int j=0;j<12;j++)
{
int thirtenn = sum+13;
sum += pingyear[j];
int result;
result = (thirtenn % 7 + nexttime - 1) % 7;
count[result]++;
}
nexttime = (365 % 7 + nexttime -1) % 7 + 1;
}
}
cout<<count[6]<<endl;
for(int j=0;j<6;j++)
cout<<count[j]<<endl;
return 0;
}
Friday the Thirteenth 黑色星期五
最新推荐文章于 2023-06-29 20:25:30 发布