密码高尔夫新年版-罗马数字整数 [英] Code Golf New Year Edition - Integer to Roman Numeral

查看:100
本文介绍了密码高尔夫新年版-罗马数字整数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

编写一个使用单个命令行参数N并打印出相应罗马数字.

Write a program that take a single command line argument N and prints out the corresponding Roman Numeral.

例如N = 2009,则应打印MMIX.

Eg N = 2009 should print MMIX.

让我们说这应该适用于0< N < 3000.

Let's say this should work for 0 < N < 3000.

(很高兴在

(Had fun playing my first ever round of code golf with the Christmas edition, and thought this could fit for New Year. Googled to see if this has come up before elsewhere and it looks like it hasn't, but let me know if this is too hard or too easy or if the rules need changing. )

MMIX开心!

推荐答案

Perl:69个笔画(算作他们!)

69个笔画包括首先调用perl:

Perl: 69 strokes (count 'em!)

Sixty-nine strokes including calling perl in the first place:

$ perl -ple's!.!($#.=5x$&*8%29628)=~y$IVCXL4620-8$XLMCDIXV$d!eg;last}{'
3484
MMMCDLXXXIV

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆