結果

問題 No.559 swapAB列
ユーザー htensaihtensai
提出日時 2019-11-14 21:20:43
言語 Java21
(openjdk 21)
結果
AC  
実行時間 134 ms / 2,000 ms
コード長 351 bytes
コンパイル時間 2,717 ms
コンパイル使用メモリ 74,556 KB
実行使用メモリ 57,564 KB
最終ジャッジ日時 2023-10-22 00:22:24
合計ジャッジ時間 4,833 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
56,172 KB
testcase_01 AC 132 ms
57,044 KB
testcase_02 AC 134 ms
57,464 KB
testcase_03 AC 127 ms
57,312 KB
testcase_04 AC 131 ms
57,532 KB
testcase_05 AC 129 ms
57,120 KB
testcase_06 AC 128 ms
57,468 KB
testcase_07 AC 129 ms
57,428 KB
testcase_08 AC 129 ms
57,564 KB
testcase_09 AC 130 ms
57,492 KB
権限があれば一括ダウンロードができます

ソースコード

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