結果

問題 No.1422 Social Distance in Train
ユーザー 👑 箱
提出日時 2020-12-09 09:33:27
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 301 ms / 2,000 ms
コード長 632 bytes
コンパイル時間 13,488 ms
コンパイル使用メモリ 431,188 KB
実行使用メモリ 51,812 KB
最終ジャッジ日時 2023-10-19 04:46:37
合計ジャッジ時間 20,175 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 290 ms
51,792 KB
testcase_01 AC 289 ms
51,796 KB
testcase_02 AC 292 ms
51,808 KB
testcase_03 AC 293 ms
51,808 KB
testcase_04 AC 301 ms
51,808 KB
testcase_05 AC 301 ms
51,808 KB
testcase_06 AC 295 ms
51,804 KB
testcase_07 AC 297 ms
51,800 KB
testcase_08 AC 289 ms
51,808 KB
testcase_09 AC 291 ms
51,812 KB
testcase_10 AC 292 ms
51,800 KB
testcase_11 AC 294 ms
51,796 KB
testcase_12 AC 292 ms
51,796 KB
testcase_13 AC 290 ms
51,808 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.PrintWriter
import java.util.*
import kotlin.math.*

fun PrintWriter.solve() {
    val n = nextInt()
    println(if (n % 2 == 1) 1 else n / 2 + 1)
}

fun main() {
    val writer = PrintWriter(System.out, false)
    writer.solve()
    writer.flush()
}

// region Scanner
private 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
0