結果

問題 No.346 チワワ数え上げ問題
ユーザー 🍡yurahuna🍡yurahuna
提出日時 2016-02-19 20:14:20
言語 C++11
(gcc 11.4.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 699 bytes
コンパイル時間 685 ms
コンパイル使用メモリ 58,784 KB
実行使用メモリ 8,744 KB
最終ジャッジ日時 2023-10-23 18:33:48
合計ジャッジ時間 5,475 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
8,744 KB
testcase_01 AC 2 ms
4,372 KB
testcase_02 AC 2 ms
4,372 KB
testcase_03 AC 2 ms
4,372 KB
testcase_04 AC 1 ms
4,372 KB
testcase_05 AC 2 ms
4,372 KB
testcase_06 AC 2 ms
4,372 KB
testcase_07 AC 1 ms
4,372 KB
testcase_08 AC 1 ms
4,372 KB
testcase_09 AC 2 ms
4,372 KB
testcase_10 AC 144 ms
4,372 KB
testcase_11 AC 50 ms
4,372 KB
testcase_12 AC 86 ms
4,372 KB
testcase_13 AC 41 ms
4,372 KB
testcase_14 AC 2 ms
4,372 KB
testcase_15 AC 77 ms
4,372 KB
testcase_16 AC 100 ms
4,372 KB
testcase_17 AC 139 ms
4,372 KB
testcase_18 AC 137 ms
4,372 KB
testcase_19 AC 106 ms
4,372 KB
testcase_20 TLE -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define FORR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define pb push_back
#define ALL(a) (a).begin(),(a).end()

typedef long long ll;

int main() {
    string S;
    cin >> S;
    ll N = S.length();
    ll sm = 0;
    REP(i, N) {
        if (S[i] == 'c') {
            ll w = 0;
            FOR(j, i+1, N) {
                if (S[j] == 'w') {
                    w++;
                }
            }
            sm += w * (w - 1) / 2;
        }
    }
    cout << sm << endl;
    return 0;
}
0