結果
問題 | No.559 swapAB列 |
ユーザー |
|
提出日時 | 2017-08-25 22:32:27 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 602 bytes |
コンパイル時間 | 1,242 ms |
コンパイル使用メモリ | 158,580 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-15 16:01:03 |
合計ジャッジ時間 | 1,724 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 7 |
ソースコード
#include <bits/stdc++.h>using namespace std;typedef signed long long ll;#define ALL(a) (a.begin()),(a.end())#define ZERO(a) memset(a, 0, sizeof(a))#define MINUS(a) memset(a,0xff,sizeof(a))#define SIZE(array) (sizeof(array) / sizeof(array[0]))long mod = 1000000007L;auto cmp = [](pair<int, pair<int, long>> const & a, pair<int, pair<int, long>> const & b) {return a.second.second < b.second.second;};signed main() {string s;cin >> s;int ap = 0;int cost = 0;for (int i = 0; i < s.size(); i++) {if (s[i] == 'A') {cost += i - ap;ap ++;}}cout << cost << endl;}