結果
| 問題 |
No.2419 MMA文字列2
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-08-12 16:29:49 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 552 bytes |
| コンパイル時間 | 1,511 ms |
| コンパイル使用メモリ | 175,212 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-20 06:10:01 |
| 合計ジャッジ時間 | 3,098 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / 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++){
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;
}
}
ser[S[i]]++;
}
cout << ans << endl;
}