結果

問題 No.805 UMG
ユーザー ktgw0316ktgw0316
提出日時 2019-04-07 22:47:22
言語 Kotlin
(1.9.23)
結果
RE  
実行時間 -
コード長 375 bytes
コンパイル時間 13,306 ms
コンパイル使用メモリ 435,552 KB
実行使用メモリ 51,176 KB
最終ジャッジ日時 2024-04-29 10:51:38
合計ジャッジ時間 24,628 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 309 ms
50,664 KB
testcase_02 AC 313 ms
50,608 KB
testcase_03 RE -
testcase_04 AC 314 ms
50,720 KB
testcase_05 AC 308 ms
50,688 KB
testcase_06 AC 310 ms
50,956 KB
testcase_07 AC 318 ms
50,916 KB
testcase_08 AC 310 ms
50,652 KB
testcase_09 AC 305 ms
50,952 KB
testcase_10 AC 317 ms
51,024 KB
testcase_11 AC 310 ms
51,060 KB
testcase_12 AC 307 ms
50,956 KB
testcase_13 AC 312 ms
51,128 KB
testcase_14 AC 308 ms
50,760 KB
testcase_15 AC 319 ms
50,748 KB
testcase_16 AC 315 ms
51,176 KB
testcase_17 AC 316 ms
50,780 KB
testcase_18 AC 334 ms
50,928 KB
testcase_19 AC 310 ms
50,684 KB
testcase_20 AC 325 ms
51,024 KB
testcase_21 AC 319 ms
51,032 KB
testcase_22 AC 329 ms
50,904 KB
testcase_23 AC 352 ms
50,960 KB
testcase_24 AC 353 ms
51,092 KB
testcase_25 AC 352 ms
51,140 KB
testcase_26 AC 354 ms
51,140 KB
testcase_27 AC 368 ms
51,100 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:1:10: warning: parameter 'args' is never used
fun main(args: Array<String>) {
         ^

ソースコード

diff #

fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val s = readLine()!!
    
    var c = 0
    for (i in s.indexOf('U')..(n - 3)) {
        if (!s[i].equals('U')) continue
        for (d in 1..((n - 1 - i) / 2)) {
            val j = i + d
            val k = j + d
            if (s[j].equals('M') && s[k].equals('G')) c++
        }
    }
    println(c)
}
0