結果

問題 No.559 swapAB列
ユーザー mame_shibemame_shibe
提出日時 2019-12-04 23:54:37
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 51 ms / 2,000 ms
コード長 808 bytes
コンパイル時間 1,785 ms
コンパイル使用メモリ 62,676 KB
実行使用メモリ 22,576 KB
最終ジャッジ日時 2023-08-21 06:41:38
合計ジャッジ時間 2,722 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 50 ms
20,512 KB
testcase_01 AC 50 ms
22,452 KB
testcase_02 AC 51 ms
22,576 KB
testcase_03 AC 50 ms
22,384 KB
testcase_04 AC 51 ms
22,432 KB
testcase_05 AC 50 ms
20,328 KB
testcase_06 AC 51 ms
22,444 KB
testcase_07 AC 51 ms
20,484 KB
testcase_08 AC 50 ms
20,532 KB
testcase_09 AC 50 ms
18,496 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace YukiCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve();
        }

        public void Solve()
        {
            string s = Console.ReadLine();

            int sum = 0;
            for (int i = 0; i < s.Length; i++)
            {
                if (s[i] == 'B')
                {
                    for (int j = i + 1; j < s.Length; j++)
                    {
                        if (s[j] == 'A') sum++;
                    }
                }

            }
            
            Console.WriteLine(sum);
            
        }
    }
}

0