結果

問題 No.996 Phnom Penh
ユーザー Respect2DRespect2D
提出日時 2020-02-21 21:54:48
言語 Kotlin
(1.9.23)
結果
WA  
実行時間 -
コード長 461 bytes
コンパイル時間 11,514 ms
コンパイル使用メモリ 425,824 KB
実行使用メモリ 100,592 KB
最終ジャッジ日時 2024-04-17 07:36:00
合計ジャッジ時間 23,905 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 336 ms
61,188 KB
testcase_01 AC 331 ms
95,988 KB
testcase_02 AC 336 ms
65,020 KB
testcase_03 AC 337 ms
57,872 KB
testcase_04 AC 333 ms
57,948 KB
testcase_05 AC 346 ms
58,068 KB
testcase_06 AC 332 ms
57,872 KB
testcase_07 AC 341 ms
58,012 KB
testcase_08 AC 347 ms
57,940 KB
testcase_09 AC 341 ms
57,796 KB
testcase_10 AC 342 ms
57,968 KB
testcase_11 AC 346 ms
58,052 KB
testcase_12 AC 342 ms
57,992 KB
testcase_13 AC 502 ms
60,076 KB
testcase_14 AC 503 ms
60,192 KB
testcase_15 AC 506 ms
60,148 KB
testcase_16 AC 495 ms
60,248 KB
testcase_17 AC 509 ms
60,052 KB
testcase_18 AC 341 ms
57,920 KB
testcase_19 AC 338 ms
58,012 KB
testcase_20 AC 327 ms
57,664 KB
testcase_21 AC 334 ms
57,836 KB
testcase_22 WA -
testcase_23 AC 339 ms
57,976 KB
testcase_24 TLE -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:3:10: warning: parameter 'args' is never used
fun main(args: Array<String>) {
         ^

ソースコード

diff #

import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    var s = sc.next()
    var ans = 0
    while (true) {
        var preLen = s.length
        s = s.replace("phnom", "penh")
        val replaceCount = preLen - s.length
        ans += replaceCount

        preLen = s.length
        s = s.replace("h", "").replace("e", "h")
        if (s.length == preLen) {
            break
        }
        ans++
    }
    println(ans)
}
0