Day of the week for a given date of this year. Do not use any date tools Please write a program that takes as input two numbers 'day of the month' and 'month number' for any day of this year (2012) and outputs day of the week.
Examples:

% ruby ./golf.rb 14 07 # 14th of July 
"Sat"
% ruby ./golf.rb 14 7  # the same
"Sat"
% ruby ./golf.rb 01 12 # Dec 1
"Sat"
% ruby ./golf.rb 31 12 # Last day of the year
"Mon"



Output format should be like Mon, Tue, Wed, Thu, Fri, Sat, Sun, not less than 3 letters
Do not use date libs/modules, just math and logic
Wins the shortest script in any language.
C++   (142) (135)    (129 chars)

main(){string s[]={"Mon","Tue","Wen","Thu","Fri","Sat","Sun"};int d,m,t[]={0,5,1,1,4,6,2,4,0,3,5,1,3};cin&gt;&gt;d&gt;&gt;m;cout&lt;&lt;s[(d+t[m]+15-(m&lt;3))%7];}


The requirement that the letters Mon, Tue etc. appear made it quite bad, otherwise it would be only 84 chars. I'll search a golf for the strings...

Hm, trying to golf the string only made it 2 chars longer, but I find it more aesthetically pleasing.

main(){char s[]={"MonTueWenThuFriSatSun"};int d,m,t[]={0,5,1,1,4,6,2,4,0,3,5,1,3};cin&gt;&gt;d&gt;&gt;m;d=((d+t[m]+15-(m&lt;3))%7)*3;s[d+3]=0;printf("%s",s+d);}


Well, this for my first entry at a golf contest, I have still much to learn...

HA! Got it!

main(){char s[]={"MonTueWenThuFriSatSun"},t[]={"0511462403513"};int d,m;cin&gt;&gt;d&gt;&gt;m;d=((d+t[m]-33-(m&lt;3))%7)*3;s[d+3]=0;printf("%s",s+d);}


with a well set compiler and some luck we might chop another 3 characters, by using char* instead of char[], but it will crash on most systems. Anyway, it doesn't matter, as I believe soon someone will post a solution in J or K with less than 10 characters, as usual :P

I'll never give up!

main(){char s[]={"MonTueWenThuFriSatSun0511462403513"};int d,m;cin&gt;&gt;d&gt;&gt;m;d=((d+s[m+21]-33-(m&lt;3))%7)*3;s[d+3]=0;printf("%s",s+d);}