結果
| 問題 | No.2419 MMA文字列2 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-08-12 16:25:46 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 552 bytes |
| 記録 | |
| コンパイル時間 | 1,730 ms |
| コンパイル使用メモリ | 173,504 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-20 05:54:49 |
| 合計ジャッジ時間 | 3,408 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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<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;
}