?? friday.pas
字號:
{
ID:maigoak1
PROG:friday
}
program friday;
const
monthday:array[1..12]of byte=(3,0,3,2,3,2,3,3,2,3,2,3);
var
fin,fout:text;
count:array[0..6]of integer;
years,year,month,weekday:integer;
function leap(y:integer):boolean;
begin
if y mod 100=0 then
if y mod 400=0 then leap:=true else leap:=false
else
if y mod 4=0 then leap:=true else leap:=false;
end;
begin
assign(fin,'friday.in');
reset(fin);
readln(fin,years);
close(fin);
fillchar(count,sizeof(count),0);
weekday:=6;
for year:=1900 to 1899+years do
for month:=1 to 12 do begin
inc(count[weekday]);
if month=2 then
weekday:=weekday+ord(leap(year))
else
weekday:=weekday+monthday[month];
weekday:=weekday mod 7;
end;
assign(fout,'friday.out');
rewrite(fout);
write(fout,count[6]);
for weekday:=0 to 5 do
write(fout,' ',count[weekday]);
writeln(fout);
close(fout);
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -