結果

問題 No.559 swapAB列
ユーザー fkwnw3_1243fkwnw3_1243
提出日時 2017-09-06 22:27:23
言語 Java21
(openjdk 21)
結果
AC  
実行時間 47 ms / 2,000 ms
コード長 627 bytes
コンパイル時間 3,320 ms
コンパイル使用メモリ 73,208 KB
実行使用メモリ 37,060 KB
最終ジャッジ日時 2024-04-24 15:24:13
合計ジャッジ時間 4,021 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 46 ms
36,500 KB
testcase_01 AC 47 ms
36,876 KB
testcase_02 AC 46 ms
36,408 KB
testcase_03 AC 46 ms
36,416 KB
testcase_04 AC 45 ms
36,824 KB
testcase_05 AC 47 ms
36,908 KB
testcase_06 AC 46 ms
37,060 KB
testcase_07 AC 46 ms
36,432 KB
testcase_08 AC 46 ms
36,976 KB
testcase_09 AC 47 ms
36,564 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

import static java.lang.System.in;

public class No559 {
    public static void main(String[] args) throws IOException {

        BufferedReader reader = new BufferedReader(new InputStreamReader(in));

        int numOfB = 0;

        String S = reader.readLine();

        int counter = 0;

        for (int i = 0; i < S.length(); i++) {
            if (S.charAt(i) == 'A') {
                counter += numOfB;
            } else {
                numOfB += 1;
            }
        }

        System.out.println(counter);

    }
}
0