usaco 1.1.3.Friday(黑色星期五)
usaco 1.1.3.Friday(黑色星期五)我是pascal看看:var i,n,day,month,year:longint;a:array[1..7]of longint;beginreadln(n);month:=1;year:=1900;for i:=1 to 7 doa[i]:=0;a[6]:=1;day:=6;for i:=2 to 12*n dobegininc(month);if month =13 then begin inc(year);month:=1;end;if month in[1,2,4,6,8,9,11] then day:=day+3;{month in when=the time from when-1 to when}if month in[5,7,10,12] then day:=day+2;if month=3 thenif (year mod 400=0)or((year mod 4=0)and(year mod 1000)) thenday:=day+1else day:=day;if day>7 then day:=day mod 7;inc(a[day]);end;writeln(a[6],' ',a[7],' ',a[1],' ',a[2],' ',a[3],' ',a[4],' ',a[5]);end.
最佳回答
program friday;constmaxn=7;vartop:integer;i,n,m,j,k:longint;a:array [1。。maxn] of longint;procedure doit;beginif (top+12) mod 7=0then a[7]:=a[7]+1else a[(top+12) mod 7]:=a[(top+12) mod 7]+1;case j of1,3,5,7,8,10,12:top:=(top+30) mod 7 +1;4,6,9,11:top:=(top+29) mod 7 +1;2:if k=1then top:=(top+28) mod 7 +1else top:=(top+27) mod 7 +1;end;end;begintop:=1;k:=0;readln(n);for i:=0 to n-1 dobeginm:=i+1900;if m mod 100=0then beginif m mod 400=0then k:=1;endelse if m mod 4=0then k:=1;for j:=1 to 12 dodoit;k:=0;end;write(a[6],' ',a[7],' ');for i:=1 to 4 dowrite(a[i],' ');writeln(a[5]);end。
最新回答共有2条回答
-
2026-04-07 21:08:30妩媚的摩托
回复program friday;constmaxn=7;vartop:integer;i,n,m,j,k:longint;a:array [1。。maxn] of longint;procedure doit;beginif (top+12) mod 7=0then a[7]:=a[7]+1else a[(top+12) mod 7]:=a[(top+12) mod 7]+1;case j of1,3,5,7,8,10,12:top:=(top+30) mod 7 +1;4,6,9,11:top:=(top+29) mod 7 +1;2:if k=1then top:=(top+28) mod 7 +1else top:=(top+27) mod 7 +1;end;end;begintop:=1;k:=0;readln(n);for i:=0 to n-1 dobeginm:=i+1900;if m mod 100=0then beginif m mod 400=0then k:=1;endelse if m mod 4=0then k:=1;for j:=1 to 12 dodoit;k:=0;end;write(a[6],' ',a[7],' ');for i:=1 to 4 dowrite(a[i],' ');writeln(a[5]);end。
热门文章
- 康达学院专转本五年制
- 高考一个考场分ab卷吗
- not only but also用法
- 某物体做自由落体运动,从释放开始计时,则物体在前2s内的平均速度为______m/s,物体下落2m时的速度大小为______m/s.
- 三角函数公式大全表格
- 地理中考必背知识点2022
- 2013-2014学年小学六年级科学上学期期末考试试卷及答案
- 人教版2014-2015学年小学五年级英语第二学期期中教学质量检测试卷及答案
- 【Linux驱动开发】设备树详解(二)设备树语法详解
- 别跟客户扯细节
- 在别的城市买房子能落户吗
- 卖房前要把装修贷还完吗
- 高中政治教学提高教学效果的方法探究
- “互联网+”背景下的初中英语课堂教学改革与创新策略研究
- 2022年终止合同范本
- 租房合同范本范文
- 如何挑选土豆
- 如何挑选土鸡
