結果

問題 No.852 連続部分文字列
ユーザー CuriousFairy315
提出日時 2019-03-20 16:43:04
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 412 bytes
コンパイル時間 579 ms
コンパイル使用メモリ 73,288 KB
最終ジャッジ日時 2025-01-06 23:37:53
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other AC * 12 WA * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<cstdint>
#include<iomanip>
using namespace std; // 575

int main() {
	string S;
	cin >> S;
    int use[26] = {};
    int64_t sum = (int64_t)13 * S.size() * (S.size() + 1);
    for (int i = 0;i < S.size();++ i) for (int j = 0;j < 26;++ j) sum -= use[j] = S[i] == j + 'a' ? 0 : use[j] + 1;
	cout << setprecision(3) << fixed << sum * 2.0 / S.size() / (S.size() + 1) << endl;
	return 0;
}
0