結果
問題 | No.852 連続部分文字列 |
ユーザー |
|
提出日時 | 2019-07-27 15:11:29 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 432 bytes |
コンパイル時間 | 786 ms |
コンパイル使用メモリ | 74,812 KB |
実行使用メモリ | 19,668 KB |
最終ジャッジ日時 | 2024-07-02 11:00:44 |
合計ジャッジ時間 | 5,657 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 3 |
other | WA * 10 TLE * 1 -- * 30 |
ソースコード
#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; }