結果

問題 No.559 swapAB列
ユーザー huffman56huffman56
提出日時 2023-01-14 09:55:13
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 30 ms / 2,000 ms
コード長 589 bytes
コンパイル時間 4,931 ms
コンパイル使用メモリ 102,400 KB
実行使用メモリ 17,408 KB
最終ジャッジ日時 2024-12-25 15:34:15
合計ジャッジ時間 2,030 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 7
権限があれば一括ダウンロードができます
コンパイルメッセージ
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 System.Numerics;

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

            for (var i = 0; i < s.Length; i++)
            {
                if (s[i] == 'B')
                {
                    cnt++;
                }
                else
                {
                    ans += cnt;
                }
            }

            Console.WriteLine(ans);
        }
    }
}
0