open Printf let rec r p i l=printf"%2d%c"i" \n\n".[p/7*7/p+i/l];i<l&r(p+1)(i+1)l||(p-1)mod 7<2||()=printf" "let(%)m y=(y+y/4+(m+1+2/(max 2m)*(6+y/2009*3))*13/5-1)mod 7 let f m y=printf" %-17s Su Mo Tu We Th Fr Sa "([|" January";"February";" March";" April";" May";" June";" July";" August";"September";" October";"November";"December"|].(m-1)^" "^(string_of_int y)); printf"%s"(String.make(m%y*3)' ');r(m%y+1)1([|31;29;31;30;31;30;31;31;30;31;30;31|].(m-1));;while 1=1do Scanf.scanf"%d %d "f done
Note that non-ascii characters in the above source code will be escaped (such as \x9f).