結果
問題 |
No.2419 MMA文字列2
|
ユーザー |
|
提出日時 | 2023-08-12 16:20:58 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 563 bytes |
コンパイル時間 | 1,808 ms |
コンパイル使用メモリ | 173,396 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-20 05:33:38 |
合計ジャッジ時間 | 3,375 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 26 WA * 4 |
ソースコード
#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<int,int> ser; for(int i=0;i<l;i++){ int s = (int)S[i]; ser[s]++; int a = 'A'; for(int j=0;j<26;j++){ int c = a+j; if(s == c){ continue; } if(ser[c] >= 2){ int su = ser[c]; ll pl = su*(su-1)/2; ans += pl; } } } cout << ans << endl; }