結果

問題 No.380 悪の台本
ユーザー firiexpfiriexp
提出日時 2019-08-21 17:23:57
言語 Kotlin
(1.9.23)
結果
WA  
実行時間 -
コード長 814 bytes
コンパイル時間 10,079 ms
コンパイル使用メモリ 435,524 KB
実行使用メモリ 62,804 KB
最終ジャッジ日時 2024-04-30 21:14:57
合計ジャッジ時間 14,831 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 RE -
testcase_02 AC 265 ms
56,756 KB
testcase_03 AC 263 ms
56,760 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 RE -
testcase_08 AC 378 ms
59,088 KB
testcase_09 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:3:18: warning: 'toLowerCase(): String' is deprecated. Use lowercase() instead.
    var s = line.toLowerCase();
                 ^
Main.kt:22:10: warning: parameter 'args' is never used
fun main(args: Array<String>) {
         ^

ソースコード

diff #

fun solve(line: String): Boolean {
    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.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