Last active
December 16, 2015 07:09
-
-
Save kingori/5397117 to your computer and use it in GitHub Desktop.
프로젝트 오일러 1번 풀이
This file contains 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
class Euler1 { | |
/** | |
* 1 부터 maxVal 미만의 수 중 3 또는 5의 배수의 합 | |
* @param maxVal | |
* @return | |
*/ | |
def getMultipleOf3Or5(maxVal: Int) = { | |
(0 /: (1 until maxVal).filter((arg: Int) => (arg % 3 == 0 || arg % 5 == 0)))(_ + _) | |
} | |
} | |
object Euler1 extends App { | |
Console.out.println("1 to 10:" + new Euler1().getMultipleOf3Or5(10)) | |
Console.out.println("1 to 1000:" + new Euler1().getMultipleOf3Or5(1000)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment