Submit an Entry

To enter the challenge, you need to signup or login.

This Challenge's Best Entries [View All]

(View the Overall | Perl | PHP | Python | Ruby leaderboard.)

Rank User Size Language Score [?]
1st flagitious 232 Ruby 10,000 (v26)
2nd shinh 273 Ruby 8,498 (v67)
3rd mame 280 Ruby 8,285 (v7)
4th ySas 284 Perl 8,169 (v79)
5th jojo 285 Ruby 8,140 (v16)
6th ozy4dm 288 Ruby 8,055 (v26)
7th irori 314 Ruby 7,388 (v12)
8th adel 325 Ruby 7,138 (v4)
9th yowa 328 Ruby 7,073 (v8)
10th yvl 329 Ruby 7,051 (v11)

See who is active in this challenge →

Calendar

(Challenge added 1499 days ago.)

Why buy calendars, when you can make your own?

Discuss This Challenge →

The Problem

Your task, should you choose to accept it, is to write the shortest program that will display the full calendar for any year between 1753 and 2399 inclusive. Sounds simple enough, but there are a few gotchas you need to look out for, you have to format it in a specific way, and of course, do it in the least number of characters possible.

The format we want your program to generate is largely the same as the UNIX command cal. Don't worry if you're not familiar with cal's output or don't have access to it, you don't need it to take part in this challenge.

You might find the information at Wikipedia's Gregorian calendar page useful.

Other Information

  • Your program will be run 7 times. The first four times you will be asked to generate calendars for the years 1900, 2000, 2399 and 1753. The next three times you will be asked to generate calendars for three random years in the range 1753-2399 inclusive. These last three years will be different each time.
  • Each year will be provided on stdin (followed by a newline), and only one year per run will be provided. Your output is expected on stdout.

Rather than labourously explaining the format of the output, part of the exercise is to work out the general format yourself from the examples below!

Examples

As mentioned above, the first four runs will be run for the same years each time. To see the expected output for these runs, click the following links :

For the other runs, you'll receive random years.