euro denominations by vlo (Nik)

z=c(c(5,2,1)%o%c(1e4,1e3,100,10,1))
b=function(x){
o=c()
while(x){
b=x%/%z
a=b[b>0][1]
c=z[which(b>0)][1]
x=x-a*c
o=c(o,rep(c,a))}
cat(o,sep="+");cat("\n")}
for(i in scan("stdin"))b(i)

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

download

return to the top page