結果

問題 No.380 悪の台本
ユーザー firiexpfiriexp
提出日時 2020-01-01 19:36:48
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 672 ms / 1,000 ms
コード長 1,156 bytes
コンパイル時間 14,105 ms
コンパイル使用メモリ 442,632 KB
実行使用メモリ 63,256 KB
最終ジャッジ日時 2024-05-02 05:43:45
合計ジャッジ時間 18,762 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 261 ms
51,124 KB
testcase_01 AC 262 ms
51,180 KB
testcase_02 AC 257 ms
50,828 KB
testcase_03 AC 260 ms
51,212 KB
testcase_04 AC 368 ms
52,376 KB
testcase_05 AC 449 ms
57,928 KB
testcase_06 AC 445 ms
57,252 KB
testcase_07 AC 672 ms
63,256 KB
testcase_08 AC 331 ms
51,972 KB
testcase_09 AC 370 ms
52,448 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:10:18: warning: 'toLowerCase(): String' is deprecated. Use lowercase() instead.
    var s = line.toLowerCase();
                 ^
Main.kt:30:10: warning: parameter 'args' is never used
fun main(args: Array<String>) {
         ^

ソースコード

diff #

@JvmField val INPUT = System.`in`
@JvmField val OUTPUT = System.out

@JvmField val _reader = INPUT.bufferedReader()
fun readLine(): String? = _reader.readLine()
fun readL() = _reader.readLine()!!

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") && s != "digi"
    }else if (line.startsWith("petit ")){
        return s.endsWith("nyu") && s != "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") && s != "gema"
    }else if(line.startsWith("piyo "))
        return s.endsWith("pyo") && s != "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