結果

問題 No.559 swapAB列
ユーザー htensai
提出日時 2019-11-14 21:20:43
言語 Java
(openjdk 23)
結果
AC  
実行時間 116 ms / 2,000 ms
コード長 351 bytes
コンパイル時間 2,197 ms
コンパイル使用メモリ 73,624 KB
実行使用メモリ 41,108 KB
最終ジャッジ日時 2024-09-22 01:46:50
合計ジャッジ時間 4,059 ms
ジャッジサーバーID
(参考情報)
judge3 / 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();
		int bCount = 0;
		int total = 0;
		for (char c : arr) {
		    if (c == 'A') {
		        total += bCount;
		    } else {
		        bCount++;
		    }
		}
		System.out.println(total);
	}
}
0