結果

問題 No.805 UMG
ユーザー ktgw0316ktgw0316
提出日時 2019-04-07 22:49:46
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 338 ms / 2,000 ms
コード長 362 bytes
コンパイル時間 14,585 ms
コンパイル使用メモリ 429,176 KB
実行使用メモリ 50,076 KB
最終ジャッジ日時 2024-04-29 10:52:43
合計ジャッジ時間 22,262 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 286 ms
49,780 KB
testcase_01 AC 288 ms
49,612 KB
testcase_02 AC 287 ms
49,648 KB
testcase_03 AC 286 ms
49,624 KB
testcase_04 AC 285 ms
49,692 KB
testcase_05 AC 303 ms
49,552 KB
testcase_06 AC 300 ms
49,824 KB
testcase_07 AC 289 ms
49,664 KB
testcase_08 AC 289 ms
49,624 KB
testcase_09 AC 290 ms
49,628 KB
testcase_10 AC 289 ms
49,520 KB
testcase_11 AC 298 ms
49,524 KB
testcase_12 AC 288 ms
49,608 KB
testcase_13 AC 285 ms
49,640 KB
testcase_14 AC 284 ms
49,768 KB
testcase_15 AC 299 ms
49,820 KB
testcase_16 AC 306 ms
49,676 KB
testcase_17 AC 292 ms
49,884 KB
testcase_18 AC 303 ms
49,968 KB
testcase_19 AC 296 ms
49,732 KB
testcase_20 AC 306 ms
49,780 KB
testcase_21 AC 304 ms
49,808 KB
testcase_22 AC 303 ms
49,524 KB
testcase_23 AC 333 ms
50,072 KB
testcase_24 AC 337 ms
49,812 KB
testcase_25 AC 338 ms
49,944 KB
testcase_26 AC 327 ms
50,076 KB
testcase_27 AC 334 ms
49,976 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 0..(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