結果
問題 | No.1389 Clumsy Calculation |
ユーザー |
|
提出日時 | 2021-02-12 21:29:50 |
言語 | Kotlin (2.1.0) |
結果 |
AC
|
実行時間 | 614 ms / 2,000 ms |
コード長 | 840 bytes |
コンパイル時間 | 14,251 ms |
コンパイル使用メモリ | 441,692 KB |
実行使用メモリ | 89,028 KB |
最終ジャッジ日時 | 2024-07-19 20:22:03 |
合計ジャッジ時間 | 28,252 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 26 |
ソースコード
import java.io.PrintWriterimport java.util.*fun PrintWriter.solve() {val n = nextInt()val x = nextLong()val s = Array(n) { nextLong() }val sum = s.sum()for (i in 0 until n) {if (s[i] % 2 != 0L) continueval v = sum - s[i] / 2if ((n - 1) * x == v) {println(s[i] / 2)return}}}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