結果

問題 No.2419 MMA文字列2
ユーザー marble72marble72
提出日時 2023-08-12 16:25:46
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 552 bytes
コンパイル時間 1,685 ms
コンパイル使用メモリ 173,812 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-30 11:21:05
合計ジャッジ時間 3,372 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 1 ms
6,944 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 2 ms
6,944 KB
testcase_08 AC 2 ms
6,944 KB
testcase_09 AC 2 ms
6,940 KB
testcase_10 AC 2 ms
6,940 KB
testcase_11 AC 2 ms
6,940 KB
testcase_12 AC 17 ms
6,944 KB
testcase_13 AC 4 ms
6,944 KB
testcase_14 AC 30 ms
6,940 KB
testcase_15 AC 19 ms
6,944 KB
testcase_16 AC 32 ms
6,944 KB
testcase_17 AC 11 ms
6,944 KB
testcase_18 AC 32 ms
6,944 KB
testcase_19 AC 33 ms
6,944 KB
testcase_20 AC 12 ms
6,944 KB
testcase_21 AC 9 ms
6,940 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 6 ms
6,944 KB
testcase_27 AC 36 ms
6,940 KB
testcase_28 AC 67 ms
6,940 KB
testcase_29 AC 67 ms
6,944 KB
testcase_30 AC 67 ms
6,944 KB
testcase_31 AC 66 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main(){
    string S;
    cin >> S;
    int l = S.length();
    ll ans=0;
    map<char,int> ser;
    for(int i=0;i<l;i++){
        ser[S[i]]++;
        int a = 'A';
        for(int j=0;j<26;j++){
            char c = (char)(a+j);
            if(S[i] == c){
                continue;
            }
            if(ser[c] >= 2){
                int su = ser[c];
                ll pl = su*(su-1)/2;
                ans += pl;
            }
        }
    }
    cout << ans << endl;
}
0