結果

問題 No.380 悪の台本
ユーザー firiexpfiriexp
提出日時 2019-08-21 17:32:06
言語 Kotlin
(1.9.23)
結果
WA  
実行時間 -
コード長 903 bytes
コンパイル時間 10,001 ms
コンパイル使用メモリ 444,460 KB
実行使用メモリ 68,336 KB
最終ジャッジ日時 2024-04-30 21:17:32
合計ジャッジ時間 14,791 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 267 ms
56,876 KB
testcase_02 AC 266 ms
56,804 KB
testcase_03 AC 257 ms
56,720 KB
testcase_04 AC 420 ms
61,964 KB
testcase_05 AC 461 ms
61,748 KB
testcase_06 AC 451 ms
62,052 KB
testcase_07 AC 670 ms
68,336 KB
testcase_08 AC 366 ms
59,316 KB
testcase_09 AC 443 ms
60,068 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:4:18: warning: 'toLowerCase(): String' is deprecated. Use lowercase() instead.
    var s = line.toLowerCase();
                 ^
Main.kt:24: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.isEmpty()) return false
        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 >= 5 && 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