結果

問題 No.805 UMG
ユーザー chika0707chika0707
提出日時 2019-03-22 22:20:46
言語 C#(csc)
(csc 3.9.0)
結果
RE  
実行時間 -
コード長 1,589 bytes
コンパイル時間 936 ms
コンパイル使用メモリ 113,356 KB
実行使用メモリ 26,128 KB
最終ジャッジ日時 2024-04-29 10:37:51
合計ジャッジ時間 2,544 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 23 ms
21,944 KB
testcase_01 AC 25 ms
24,112 KB
testcase_02 AC 25 ms
26,128 KB
testcase_03 AC 24 ms
23,744 KB
testcase_04 AC 23 ms
22,192 KB
testcase_05 AC 23 ms
25,884 KB
testcase_06 AC 22 ms
24,128 KB
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 AC 24 ms
24,080 KB
testcase_13 RE -
testcase_14 AC 25 ms
24,000 KB
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Linq;
using static Input;

public class Prog
{
    private const int INF = 1000000007;
    private const long INFINITY = 9223372036854775807;
    public static void Main()
    {
        int N = NextInt();
        string S = NextString();
        long ans = 0;
        for (int i = 0; i < N; i++)
        {
            if (S[i] == 'M')
            {
                int min = Math.Min(i, N - i);
                for (int j = 1; j <= min; j++) {
                    if (S[i - j] == 'U' && S[i + j] == 'G') ans++;
                }
            }
        }
        Console.WriteLine(ans);
    }
}

public class Input
{
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
}
0