結果

問題 No.9002 FizzBuzz(テスト用)
ユーザー rutilicusrutilicus
提出日時 2020-08-30 20:41:03
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 291 ms / 5,000 ms
コード長 414 bytes
コンパイル時間 11,767 ms
コンパイル使用メモリ 426,384 KB
実行使用メモリ 56,868 KB
最終ジャッジ日時 2024-04-27 13:12:23
合計ジャッジ時間 12,960 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 288 ms
56,868 KB
testcase_01 AC 287 ms
56,648 KB
testcase_02 AC 290 ms
56,828 KB
testcase_03 AC 291 ms
56,748 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:7:17: warning: 'appendln(Any?): kotlin.text.StringBuilder /* = java.lang.StringBuilder */' is deprecated. Use appendLine instead. Note that the new method always appends the line feed character '\n' regardless of the system line separator.
        builder.appendln(
                ^

ソースコード

diff #

fun main() {
    val builder = StringBuilder()

    val n = readInputLine().toInt()

    for (i in 1..n) {
        builder.appendln(
            when {
                i % 15 == 0 -> "FizzBuzz"
                i % 5 == 0 -> "Buzz"
                i % 3 == 0 -> "Fizz"
                else -> i
            }
        )
    }

    print(builder.toString())
}

fun readInputLine(): String {
    return readLine()!!
}
0