cal by nn

c=Calendar.getInstance()
System.in.eachLine{{m,y->c.set(y-1900,m-1,1)
l=c.getActualMaximum(Calendar.DATE)
i=(c.get(Calendar.DAY_OF_WEEK)+2)%7
o=sprintf('%tB '+y,c).center(20)+'\nSu Mo Tu We Th Fr Sa'+(i?'\n'+' '*(3*i-1):'')
for(j=0;j++<l;o+=j>9?j:' '+j)o+=i++%7?' ':'\n'
println i<36?o+'\n':o}it.split()*.toInteger()}

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page