結果

問題 No.559 swapAB列
ユーザー ats5515
提出日時 2017-08-25 22:29:15
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 332 bytes
コンパイル時間 515 ms
コンパイル使用メモリ 64,224 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-15 15:59:11
合計ジャッジ時間 971 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <vector>
#include <math.h>
using namespace std;
#define int long long

signed main() {
	string s;
	cin >> s;
	int res = 0;
	int st = 0;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == 'A') {
			res += i - st;
			st++;
		}
	}
	cout << res << endl;
	return 0;
}
0