結果
問題 | No.559 swapAB列 |
ユーザー |
![]() |
提出日時 | 2017-09-06 22:27:23 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 54 ms / 2,000 ms |
コード長 | 627 bytes |
コンパイル時間 | 3,327 ms |
コンパイル使用メモリ | 73,532 KB |
実行使用メモリ | 37,108 KB |
最終ジャッジ日時 | 2024-11-06 23:56:44 |
合計ジャッジ時間 | 4,603 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 7 |
ソースコード
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);}}