結果
| 問題 |
No.805 UMG
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-03-22 22:20:46 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,589 bytes |
| コンパイル時間 | 4,479 ms |
| コンパイル使用メモリ | 112,180 KB |
| 実行使用メモリ | 26,012 KB |
| 最終ジャッジ日時 | 2024-11-18 13:26:37 |
| 合計ジャッジ時間 | 2,704 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 6 RE * 19 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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(); }
}