結果

問題 No.380 悪の台本
ユーザー firiexpfiriexp
提出日時 2019-08-21 17:33:53
言語 Kotlin
(1.9.23)
結果
WA  
実行時間 -
コード長 922 bytes
コンパイル時間 12,826 ms
コンパイル使用メモリ 443,012 KB
実行使用メモリ 68,296 KB
最終ジャッジ日時 2024-04-30 21:17:54
合計ジャッジ時間 18,282 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 316 ms
56,840 KB
testcase_01 WA -
testcase_02 AC 312 ms
56,832 KB
testcase_03 AC 313 ms
56,740 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 760 ms
68,296 KB
testcase_08 AC 438 ms
59,352 KB
testcase_09 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.last() != ' ') 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