Submission #3793644


Source Code Expand

Copy
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <numeric>

typedef long long ll;
using namespace std;

int main() {
    
    string s;
    cin >> s;
    
    int n = s.size();
    
    ll ans = 0;
    int index = 0;
    for (int i = 0; i < n; i++) {
        if (s[i] == 'W') {
            ans += i - index;
            index++;
        }
    }
    
    cout << ans << endl;
    
}

Submission Info

Submission Time
Task A - Irreversible operation
User ganmodokix
Language C++14 (GCC 5.4.1)
Score 300
Code Size 483 Byte
Status AC
Exec Time 9 ms
Memory 640 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 2
AC × 14
Set Name Test Cases
Sample sample01.txt, sample02.txt
All sample01.txt, sample02.txt, in01.txt, in02.txt, in03.txt, in04.txt, in05.txt, in06.txt, in07.txt, in08.txt, in09.txt, in10.txt, sample01.txt, sample02.txt
Case Name Status Exec Time Memory
in01.txt AC 9 ms 640 KB
in02.txt AC 8 ms 640 KB
in03.txt AC 9 ms 640 KB
in04.txt AC 8 ms 640 KB
in05.txt AC 9 ms 640 KB
in06.txt AC 8 ms 640 KB
in07.txt AC 8 ms 640 KB
in08.txt AC 8 ms 640 KB
in09.txt AC 8 ms 640 KB
in10.txt AC 8 ms 640 KB
sample01.txt AC 1 ms 256 KB
sample02.txt AC 1 ms 256 KB