結果

問題 No.852 連続部分文字列
ユーザー ohreitetsuohreitetsu
提出日時 2019-07-27 15:11:29
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 432 bytes
コンパイル時間 1,328 ms
コンパイル使用メモリ 74,916 KB
実行使用メモリ 15,968 KB
最終ジャッジ日時 2023-09-15 06:16:06
合計ジャッジ時間 6,343 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
権限があれば一括ダウンロードができます

ソースコード

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("%llf",S1/S2);

	return 0;
}
0