challenge 年間カレンダー

nを入力としてn年の年間カレンダーを返すプログラムを作ってください
少なくとも日曜日と土曜日が判別出来るようにしてください
出力は標準出力でもファイルでも構いません
デザインは各自のお好みで

出力例1:
(y-calendar 2008)=>
#=Saturday, @=Sunday
2008/1 1 2 3 4 #5 @6 7 ...
2008/2 1 #2 @3 4 5 6 7 ...
...
2008/12 1 2 3 4 5 #6 @7 ...

出力例2:
(y-calendar 2008)=>
        M T W T F S S M
2008/ 1   1 2 3 4 5 6 7 ...
2008/ 2         1 2 3 4 ...
...
2008/12 1 2 3 4 5 6 7 8 ...

出力例3:
(y-calendar 2008)は2008.htmlを出力する
2008.htmlの中身
----
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
       "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>2008 calendar</title>
<style type="text/css">
* {font-family: monospace;}
span {margin: 0px 3px;}
span.sunday {color:red;font-weight:bold;}
span.saturday {color:blue;font-weight:bold;}
dd ul li{display:inline;}
</style>
</head>
<body>
<h1>2008 calendar</h1>
<dl>
<dt>2008/1</dt>
<dd><ul>
<li><span class="weekday">1</span></li>
<li><span class="weekday">2</span></li>
<li><span class="weekday">3</span></li>
<li><span class="weekday">4</span></li>
<li><span class="saturday">5</span></li>
<li><span class="sunday">6</span></li>
...
</ul></dd>
...
</dl>
</body>
</html>
----

Posted feedbacks - J

ひたすらコンパクトさ目指して、32進表記とか。
   cal 2008
uv12345 6789abc defghij klmnopq 
rstuv12 3456789 abcdefg hijklmn 
opqrst1 2345678 9abcdef ghijklm 
nopqrst uv12345 6789abc defghij 
klmnopq rstu123 456789a bcdefgh 
ijklmno pqrstuv 1234567 89abcde 
fghijkl mnopqrs tu12345 6789abc 
defghij klmnopq rstuv12 3456789 
abcdefg hijklmn opqrstu v123456 
789abcd efghijk lmnopqr stu1234 
56789ab cdefghi jklmnop qrstuv1 
2345678 9abcdef ghijklm nopqrst 
u123456 789abcd efghijk lmnopqr 
stuv123 456789a bcdefgh ijklmno 
1
2
3
load 'dates'
n32=:{&' 123456789abcdefghijklmnopqrstuv'
cal=:3 :'14 32$,,.&'' ''_7[\n32"0[,2}."1 todate((todayno-weekday)y,1 1)+i.400'

Index

Feed

Other

Link

Pathtraq

loading...