This is a typical Brute Force.There's nothing to say because this is so easy!All you need is to notice the details.
program friday(input,output);
const
monthday:array[1..12]of byte=(3,0,3,2,3,2,3,3,2,3,2,3);
var
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(input,'friday.in');
reset(input);
readln(input,years);
close(input);

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(output,'friday.out');
rewrite(output);
write(output,count[6]);
for weekday:=0 to 5 do
write(output,' ',count[weekday]);
writeln(output);
close(output);
end.
To download the PASCAL source file:<a href=http://www1.51ok.com/down.do?85FA5DFA93D8E290AA9CFFADC67D36B7>friday.pas</a>







































