結果

問題 No.852 連続部分文字列
ユーザー ohreitetsu
提出日時 2019-07-27 15:13:07
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 433 bytes
コンパイル時間 656 ms
コンパイル使用メモリ 73,600 KB
実行使用メモリ 17,188 KB
最終ジャッジ日時 2024-07-02 11:00:59
合計ジャッジ時間 5,637 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other WA * 10 TLE * 1 -- * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <set>
using namespace std;
int main(int argc, char* argv[])
{

	string S;
	cin>>S;
	int i,len;
	double S1=0,S2=0;
	set<string> mySet;
	size_t sLen=S.size();
	for (len=1;len<=sLen;len++){
		for (i=0;i<=sLen-len;i++){
			string str1=S.substr(i,len);
			mySet.insert(str1);
		}
		S1+=len*(int)mySet.size();
		S2+=(int)mySet.size();
		mySet.clear();
	}
	printf("%.5lf",S1/S2);

	return 0;
}
0