AC Saber 一直出现这道题…
const readline = require('readline');
const rl=readline.createInterface({
input:process.stdin,
output:process.stdout
});
var inp=new Array([]);
rl.on('line',(str) => {
if(str=="close"){
rl.close();
return;
}
inp[0]=str;
});
var Rn=[0,31,29,31,30,31,30,31,31,30,31,30,31];
var PN=[0,31,28,31,30,31,30,31,31,30,31,30,31];
rl.on("close",()=>{
var n = parseInt(inp[0]) - 1;
var week = new Array([]);
for(var i=0;i<=6;i++) week[i]=0;
//console.log(n);
for(var i=1900;i<=1900+n;i++){
for(var j=1;j<=12;j++){
var DAYS=365;
if(i%400==0 ||( i%4==0 && i % 100!=0)){
DAYS=366;
}else{
}
var noww=0;
if(DAYS==366){
//console.log(DAYS);
}
for(var k=1900;k<i;k++){
if(k%400==0 || (k%4==0 && k%100!=0)){
noww+=366;
}else{
noww+=365;
}
}
for(var k=0;k<j;k++){
if(DAYS==366){
noww+=Rn[k];
}else{
noww+=PN[k];
//console.log(noww,PN[k]);
}
}
noww+=13;
var noweek=noww%7;
//console.log(noww,i,j,13,noweek);
week[noweek]++;
}
}
console.log(week[6],week[0],week[1],week[2],week[3],week[4],week[5]);
});
## 原本想用new Date,但Date只支持1970年后…