結果

問題 No.380 悪の台本
ユーザー firiexpfiriexp
提出日時 2019-08-21 17:28:40
言語 Kotlin
(1.9.23)
結果
WA  
実行時間 -
コード長 866 bytes
コンパイル時間 12,817 ms
コンパイル使用メモリ 449,432 KB
実行使用メモリ 68,368 KB
最終ジャッジ日時 2024-04-30 21:15:19
合計ジャッジ時間 15,331 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 RE -
testcase_02 AC 280 ms
56,972 KB
testcase_03 AC 271 ms
56,852 KB
testcase_04 AC 425 ms
62,008 KB
testcase_05 AC 466 ms
62,732 KB
testcase_06 AC 454 ms
61,728 KB
testcase_07 AC 668 ms
68,368 KB
testcase_08 AC 360 ms
59,232 KB
testcase_09 AC 442 ms
60,076 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:4:18: warning: 'toLowerCase(): String' is deprecated. Use lowercase() instead.
    var s = line.toLowerCase();
                 ^
Main.kt:23:10: warning: parameter 'args' is never used
fun main(args: Array<String>) {
         ^

ソースコード

diff #

fun solve(line: String): Boolean {
    if(line.isEmpty()) return false
    var s = line.toLowerCase();
    for (i in 0 until 3){
        if(!s.last().isLetterOrDigit()) s = s.dropLast(1)
    }
    if(s.isEmpty()) return false
    if (line.startsWith("digi ")){
        return s.endsWith("nyo")
    }else if (line.startsWith("petit ")){
        return s.endsWith("nyu");
    }else if(line.startsWith("rabi ")){
        return s.length >= 4 && s.subSequence(5, s.length).any { it.isLetterOrDigit()}
    }else if(line.startsWith("gema ")){
        return s.endsWith("gema")
    }else if(line.startsWith("piyo "))
        return s.endsWith("pyo")
    else return false
}


fun main(args: Array<String>) {
    var s : String?
    do {
        s = readLine()
        if(s == null) break
        println( if (solve(s)) "CORRECT (maybe)" else "WRONG!")
    } while (true)
}
0