結果
問題 |
No.672 最長AB列
|
ユーザー |
![]() |
提出日時 | 2018-04-17 02:26:49 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 567 bytes |
コンパイル時間 | 4,859 ms |
コンパイル使用メモリ | 106,112 KB |
実行使用メモリ | 46,892 KB |
最終ジャッジ日時 | 2024-06-27 20:20:18 |
合計ジャッジ時間 | 5,303 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 3 WA * 3 TLE * 1 -- * 9 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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); } } }