結果
問題 | No.1564 Sum of Products of Pairs |
ユーザー |
|
提出日時 | 2021-06-26 13:06:42 |
言語 | Kotlin (2.1.0) |
結果 |
AC
|
実行時間 | 1,038 ms / 2,000 ms |
コード長 | 682 bytes |
コンパイル時間 | 12,443 ms |
コンパイル使用メモリ | 438,152 KB |
実行使用メモリ | 91,420 KB |
最終ジャッジ日時 | 2024-06-25 10:12:55 |
合計ジャッジ時間 | 34,517 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 30 |
ソースコード
import java.io.PrintWriterimport java.util.*fun PrintWriter.solve() {val n = nextInt()val a = Array(2 * n) { nextLong() }a.sort()println((0 until n).map { a[2 * it] * a[2 * it + 1] }.sum())}fun main() {val writer = PrintWriter(System.out, false)writer.solve()writer.flush()}// region Scannerprivate var st = StringTokenizer("")private val br = System.`in`.bufferedReader()fun next(): String {while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())return st.nextToken()}fun nextInt() = next().toInt()fun nextLong() = next().toLong()fun nextLine() = br.readLine()fun nextDouble() = next().toDouble()// endregion