Skip to content

Instantly share code, notes, and snippets.

@hwiorn
hwiorn / euler0011.scala
Created May 28, 2013 16:01
euler 11번 문제
def gmax(s: String) = {
def r1(cond: Boolean, k: Array[List[Int]], x: Int, y: Int,xop: (Int)=>Int, yop: (Int)=>Int): Int = {
if(cond) k(y)(x) * k(yop(y))(xop(x)) * k(yop(yop(y)))(xop(xop(x))) * k(yop(yop(yop(y))))(xop(xop(xop(x))))
else 1
}
val k = s.split('\n').map{_.split(' ').map {_.toInt}.toList}
val w = k(1).length
List(for(y <- 0 to w-1; x <- 0 to w-1)
yield(List(
r1(x <= w-4, k, x, y, {_+1}, {n=>n}),