結果

問題 No.559 swapAB列
コンテスト
ユーザー uafr_cs
提出日時 2017-10-28 17:28:06
言語 Java
(openjdk 25.0.2)
コンパイル:
javac -encoding UTF8 _filename_
実行:
java -ea -Xmx700m -Xss256M -DONLINE_JUDGE=true _class_
結果
AC  
実行時間 54 ms / 2,000 ms
コード長 556 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,596 ms
コンパイル使用メモリ 82,552 KB
実行使用メモリ 41,628 KB
最終ジャッジ日時 2026-05-16 07:25:54
合計ジャッジ時間 2,968 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 7
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import java.util.Arrays;
import java.util.LinkedList;
import java.util.Scanner;

public class Main {
	
	public static long MOD = 1000000007;
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		// めんどうなので A だけ寄せる
		final char[] ins = sc.next().toCharArray();
		
		int answer =0 ;
		
		int curr_A_index = 0;
		for(int index = 0; index < ins.length; index++){
			if(ins[index] != 'A'){ continue; }
			
			answer += (index - curr_A_index);
			curr_A_index++;
		}
		
		System.out.println(answer);
	}
}
0