标签:++ 黑色星期五 usaco mda clu bsp turn int namespace
#include<bits/stdc++.h>
using namespace std;
int judge(int year)
{
if(year%4==0&&year%100||year%400==0)
return 1;
return 0;
}
int run[13]={0,31,29,31,30,31,30,31,31,30,31,30,31};
int ping[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
int week[7]={0,0,0,0,0,0,0};
int main()
{
int numyear,sumdays=0;
int i,j;
cin>>numyear;
for(i=1900;i<1900+numyear;i++)
{
if(judge(i))
{
for(j=1;j<=12;j++)
{
sumdays+=13;
week[sumdays%7]++;
sumdays+=(run[j]-13);
}
}
else
{
for(j=1;j<=12;j++)
{
sumdays+=13;
week[sumdays%7]++;
sumdays+=(ping[j]-13);
}
}
}
cout<<week[6]<<‘ ‘;
for(i=0;i<6;i++) cout<<week[i]<<‘ ‘;
cout<<endl;
return 0;
}
标签:++ 黑色星期五 usaco mda clu bsp turn int namespace
原文地址:http://www.cnblogs.com/Steven-Skywalker/p/7466838.html