結果

問題 No.805 UMG
ユーザー to_to_0121to_to_0121
提出日時 2019-03-22 21:32:59
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 74 ms / 2,000 ms
コード長 630 bytes
コンパイル時間 2,388 ms
コンパイル使用メモリ 64,708 KB
実行使用メモリ 22,736 KB
最終ジャッジ日時 2023-08-11 19:09:39
合計ジャッジ時間 3,814 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 55 ms
22,640 KB
testcase_01 AC 55 ms
22,628 KB
testcase_02 AC 56 ms
22,660 KB
testcase_03 AC 54 ms
20,704 KB
testcase_04 AC 55 ms
20,624 KB
testcase_05 AC 53 ms
20,688 KB
testcase_06 AC 56 ms
22,636 KB
testcase_07 AC 54 ms
20,632 KB
testcase_08 AC 55 ms
22,632 KB
testcase_09 AC 53 ms
20,688 KB
testcase_10 AC 54 ms
22,736 KB
testcase_11 AC 54 ms
20,756 KB
testcase_12 AC 54 ms
20,472 KB
testcase_13 AC 55 ms
20,564 KB
testcase_14 AC 55 ms
20,488 KB
testcase_15 AC 54 ms
18,480 KB
testcase_16 AC 55 ms
18,696 KB
testcase_17 AC 55 ms
20,540 KB
testcase_18 AC 55 ms
22,620 KB
testcase_19 AC 55 ms
20,692 KB
testcase_20 AC 56 ms
20,480 KB
testcase_21 AC 54 ms
20,588 KB
testcase_22 AC 55 ms
20,860 KB
testcase_23 AC 71 ms
20,488 KB
testcase_24 AC 72 ms
20,688 KB
testcase_25 AC 72 ms
20,632 KB
testcase_26 AC 73 ms
20,756 KB
testcase_27 AC 74 ms
22,608 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;
using System.Collections.Generic;
class Program
    {
    	static void Main(string[] args)
    	{
    		int n = int.Parse(Console.ReadLine());
            string s = Console.ReadLine();
            int ans = 0;
            for (int i=0; i<n-2; i++){
                if(s[i] != 'U') continue;
                for (int j = 1; i + 2 * j < n; j++)
                {
                    if (s[i + j] != 'M') continue;
                    if (s[i + 2 * j] != 'G') continue;
                    ans++;
                }
            }
            Console.WriteLine(ans);
        }
    }
    //mcs Main.cs
    //mono Main.exe
0