Created
September 17, 2013 14:21
-
-
Save kazua/6594978 to your computer and use it in GitHub Desktop.
Project Euler Problem 89
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //http://projecteuler.net/index.php?section=problems&id=89(英語) | |
| //http://odz.sakura.ne.jp/projecteuler/index.php?cmd=read&page=Problem%2089 | |
| //Kazua | |
| import scala.io.Source | |
| object problem89 { | |
| val p = "VIIII|LXXXX|DCCCC|IIII|XXXX|CCCC".r | |
| def problem89(ls : List[String]) = ls.mkString.length - ls.map(p.replaceAllIn(_, "--")).mkString.length | |
| def main(args : Array[String]) { | |
| println(problem89(Source.fromFile("e:/roman.txt").getLines.toList)) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment