結果

問題 No.1447 Greedy MtSaka
ユーザー face4face4
提出日時 2021-04-07 21:31:57
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 309 ms / 2,000 ms
コード長 353 bytes
コンパイル時間 14,843 ms
コンパイル使用メモリ 421,260 KB
実行使用メモリ 53,108 KB
最終ジャッジ日時 2023-09-05 05:18:04
合計ジャッジ時間 22,731 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 304 ms
52,652 KB
testcase_01 AC 304 ms
52,688 KB
testcase_02 AC 298 ms
52,732 KB
testcase_03 AC 301 ms
52,664 KB
testcase_04 AC 300 ms
52,856 KB
testcase_05 AC 306 ms
52,676 KB
testcase_06 AC 304 ms
53,108 KB
testcase_07 AC 305 ms
52,696 KB
testcase_08 AC 304 ms
52,812 KB
testcase_09 AC 300 ms
52,652 KB
testcase_10 AC 302 ms
52,828 KB
testcase_11 AC 300 ms
52,708 KB
testcase_12 AC 303 ms
52,660 KB
testcase_13 AC 306 ms
52,688 KB
testcase_14 AC 307 ms
53,012 KB
testcase_15 AC 309 ms
52,732 KB
testcase_16 AC 305 ms
52,712 KB
testcase_17 AC 302 ms
52,716 KB
testcase_18 AC 302 ms
52,736 KB
testcase_19 AC 308 ms
52,680 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

fun main(){
    val n = readLine()!!.toInt()
    var pos = mutableListOf<Pair<Int,Int>>()
    repeat(n){
        val (x, y) = readLine()!!.split(" ").map{it.toInt()}
        pos.add(Pair(x,y))
    }
    val (x1, y1) = pos[0]
    println(pos.zipWithNext{p2, p3 -> Math.abs((x1-p3.first)*(p2.second-p3.second)-(p2.first-p3.first)*(y1-p3.second))}.sum())
}
0