結果

問題 No.63 ポッキーゲーム
ユーザー yo-kondoyo-kondo
提出日時 2018-03-24 22:47:46
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 321 ms / 5,000 ms
コード長 650 bytes
コンパイル時間 10,978 ms
コンパイル使用メモリ 432,936 KB
実行使用メモリ 57,000 KB
最終ジャッジ日時 2024-04-30 17:29:13
合計ジャッジ時間 19,187 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 313 ms
56,880 KB
testcase_01 AC 315 ms
56,788 KB
testcase_02 AC 311 ms
56,912 KB
testcase_03 AC 321 ms
56,900 KB
testcase_04 AC 316 ms
56,820 KB
testcase_05 AC 317 ms
56,812 KB
testcase_06 AC 317 ms
56,848 KB
testcase_07 AC 316 ms
56,792 KB
testcase_08 AC 315 ms
56,904 KB
testcase_09 AC 317 ms
56,940 KB
testcase_10 AC 318 ms
56,840 KB
testcase_11 AC 319 ms
56,864 KB
testcase_12 AC 319 ms
56,896 KB
testcase_13 AC 318 ms
56,980 KB
testcase_14 AC 312 ms
56,972 KB
testcase_15 AC 310 ms
56,912 KB
testcase_16 AC 312 ms
56,788 KB
testcase_17 AC 319 ms
56,956 KB
testcase_18 AC 313 ms
57,000 KB
testcase_19 AC 313 ms
56,960 KB
testcase_20 AC 315 ms
56,848 KB
testcase_21 AC 317 ms
56,944 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:7:10: warning: parameter 'args' is never used
fun main(args: Array<String>) {
         ^

ソースコード

diff #

package yukicoder.no63

/**
 * エントリポイント
 * @param args コマンドライン引数
 */
fun main(args: Array<String>) {
    val in1 = readLine()
    println(pocky(in1))
}

/**
 * 食べるポッキーの長さを返します。
 * @param lengthAndGnaw ポッキーの長さと、かじる長さ
 * @return 食べるポッキーの長さ
 */
fun pocky(lengthAndGnaw: String?): String {
    if (lengthAndGnaw == null) {
        return ""
    }
    val sp = lengthAndGnaw.split(" ").map { it.toInt() }
    // 長さが0(割り切れる)の場合はNGのため、-1する。
    return ((sp[0] - 1) / (sp[1] * 2) * sp[1]).toString()
}
0