Last active
December 16, 2015 11:38
-
-
Save kingori/5428608 to your computer and use it in GitHub Desktop.
euler 4번 풀이
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 Euler4 { | |
def findMaxPalindrome():Int = { | |
for (i <- (1 to 9).reverse; j <- (0 to 9).reverse; k <- (0 to 9).reverse) { | |
val num = 100001 * i + 10010 * j + 1100 * k | |
for (k <- (100 to Math.sqrt(num).toInt).reverse if num % k == 0 && num / k < 1000) { | |
return num | |
} | |
} | |
return 0 | |
} | |
} | |
object Euler4 extends App { | |
println(new Euler4().findMaxPalindrome()) | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment