結果

問題 No.559 swapAB列
ユーザー tenten
提出日時 2020-09-07 23:14:56
言語 Java
(openjdk 23)
結果
AC  
実行時間 121 ms / 2,000 ms
コード長 414 bytes
コンパイル時間 1,893 ms
コンパイル使用メモリ 74,892 KB
実行使用メモリ 44,608 KB
最終ジャッジ日時 2024-11-29 11:31:29
合計ジャッジ時間 3,756 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	public static void main (String[] args) {
    	Scanner sc = new Scanner(System.in);
    	char[] arr = sc.next().toCharArray();
        long total = 0;
        int bCount = 0;
        for (char c : arr) {
            if (c == 'A') {
                total += bCount;
            } else {
                bCount++;
            }
        }
    	System.out.println(total);
	}
}
0