-
-
Save bongster/e7f50ba39215243f354a to your computer and use it in GitHub Desktop.
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
import java.io.FileInputStream | |
/** | |
* Created by bongster on 2014. 8. 22.. | |
*/ | |
object Main extends App{ | |
def getM(point : List[Int]): List[Int] ={ | |
// println(point) | |
List((point(2) + point(0)) / 2, (point(3) + point(1)) / 2) | |
} | |
System.setIn(new FileInputStream("sample.in")) | |
var cases = readLine().toInt; | |
while(cases > 0){ | |
val pointNum = readLine().toInt; | |
var list:List[List[Int]] = Nil; | |
(0 until pointNum) foreach {n => | |
val point = readLine().split(" ").toList.map(_.toInt) | |
list = list :+ point | |
} | |
val ml = list.map(getM(_)) | |
//println(ml) | |
val ml2 = ml.reduce((a, b) => { | |
println("a : " + a) | |
println("b : " + b) | |
List(a(0) + b(0) , a(1) + b(1)) | |
}) | |
println(ml2) | |
cases = cases - 1; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment