public class Main {
public static void main(String[] args) {
int []month={
0,31,28,31,30,31,30,31,31,30,31,30,31};
int y=2000,m=1,d=1,w=6,res=0;
while (true){
if(w==1||d==1)//周一或者月初
res+=2;
else res+=1;
if(y==2020&&m==10&&d==1)//退出循环
break;
d++;
w=(w+1)%7;//0(代表周日) 1(周一) 2 3 4 5 6
if((y%4==0&&y%100!=0||y%400==0)&&m==2)
{
if(d>month[m]+1)//二月多判断一天
{
d=1;
m+=1;
}
}
else{
if(d>month[m]){
//这个月结束
d=1;
m+=1;
}
}
if(m>=13)//一年过去了
{
m=1;
y+=1;
}
}
System.out.println(res);
}
}
블루 브리지 컵 달리기 운동
추천
출처blog.csdn.net/fxwentian/article/details/115252890
추천
행