結果
| 問題 |
No.559 swapAB列
|
| コンテスト | |
| ユーザー |
packer_jp
|
| 提出日時 | 2017-09-13 19:55:44 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 129 ms / 2,000 ms |
| コード長 | 609 bytes |
| コンパイル時間 | 2,269 ms |
| コンパイル使用メモリ | 76,536 KB |
| 実行使用メモリ | 41,308 KB |
| 最終ジャッジ日時 | 2024-11-07 20:03:29 |
| 合計ジャッジ時間 | 4,254 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 7 |
ソースコード
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
class Main {
public static void main(String[] args) {
new Main().compute();
}
void compute() {
Scanner sc = new Scanner(System.in);
String S = sc.next();
List<Character> SList = new ArrayList<>();
for (int i = 0; i < S.length(); i++) {
SList.add(S.charAt(i));
}
int ans = 0;
while (SList.contains('A')) {
ans += SList.indexOf('A');
SList.remove(new Character('A'));
}
System.out.println(ans);
}
}
packer_jp