結果

問題 No.672 最長AB列
ユーザー NoNo
提出日時 2018-04-17 02:26:49
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 567 bytes
コンパイル時間 3,518 ms
コンパイル使用メモリ 106,428 KB
実行使用メモリ 66,172 KB
最終ジャッジ日時 2023-09-10 04:38:30
合計ジャッジ時間 7,806 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 55 ms
66,172 KB
testcase_01 WA -
testcase_02 AC 52 ms
21,232 KB
testcase_03 AC 55 ms
23,368 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 54 ms
21,364 KB
testcase_08 AC 55 ms
23,404 KB
testcase_09 TLE -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.Linq;

namespace y
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine();

            int a = 0;
            int b = 0;
            int m = 0;
            for (int i = 0; i < s.Length; i++)
            {
                if (s[i] == 'A')
                {
                    a++;
                    b = s.Substring(0, i).Count(x => x == 'B');
                    m = 2 * (int)Math.Min(a, b);
                }

            }

            Console.WriteLine(m);
        }
    }
}
0