結果
問題 | No.1374 Absolute Game |
ユーザー |
|
提出日時 | 2021-02-07 00:44:17 |
言語 | Kotlin (2.1.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 807 bytes |
コンパイル時間 | 11,452 ms |
コンパイル使用メモリ | 439,080 KB |
実行使用メモリ | 63,752 KB |
最終ジャッジ日時 | 2024-07-03 12:46:39 |
合計ジャッジ時間 | 23,170 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 6 WA * 20 |
ソースコード
import java.io.PrintWriterimport java.util.*import kotlin.math.*fun PrintWriter.solve() {val n = nextInt()val c = Array(n) { nextLong() }var a = 0Lvar b = 0Lfor (i in 0 until n) {if (i % 2 == 0) a += c[i]else b += c[i]}println((a.absoluteValue - b.absoluteValue).absoluteValue)}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