Skip to content

Instantly share code, notes, and snippets.

@kingori
Last active December 16, 2015 11:38
Show Gist options
  • Save kingori/5428608 to your computer and use it in GitHub Desktop.
Save kingori/5428608 to your computer and use it in GitHub Desktop.
euler 4번 풀이
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