結果
問題 | No.430 文字列検索 |
ユーザー | aaaa |
提出日時 | 2017-06-05 21:35:50 |
言語 | C++11 (gcc 11.4.0) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 585 bytes |
コンパイル時間 | 432 ms |
コンパイル使用メモリ | 57,248 KB |
実行使用メモリ | 4,348 KB |
最終ジャッジ日時 | 2023-10-22 05:37:59 |
合計ジャッジ時間 | 4,158 ms |
ジャッジサーバーID (参考情報) |
judge9 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,348 KB |
testcase_01 | AC | 165 ms
4,348 KB |
testcase_02 | TLE | - |
testcase_03 | AC | 1,091 ms
4,348 KB |
testcase_04 | AC | 1 ms
4,348 KB |
testcase_05 | AC | 1 ms
4,348 KB |
testcase_06 | AC | 2 ms
4,348 KB |
testcase_07 | AC | 2 ms
4,348 KB |
testcase_08 | AC | 4 ms
4,348 KB |
testcase_09 | AC | 2 ms
4,348 KB |
testcase_10 | AC | 2 ms
4,348 KB |
testcase_11 | AC | 733 ms
4,348 KB |
testcase_12 | AC | 735 ms
4,348 KB |
testcase_13 | AC | 734 ms
4,348 KB |
testcase_14 | AC | 1,297 ms
4,348 KB |
testcase_15 | AC | 1,507 ms
4,348 KB |
testcase_16 | TLE | - |
testcase_17 | TLE | - |
ソースコード
#include <iostream> #include <string> using namespace std; string s; int m; string* arr; void input(string& s, int& m, string*& arr) { cin >> s; cin >> m; arr = new string[m]; for (int i = 0; i < m; ++i) { cin >> arr[i]; } } int getNum(int i) { string test = arr[i]; size_t pos = 0; int ret = 0; pos = s.find(test); while (pos != string::npos) { ret++; pos = s.find(test, pos + 1); } return ret; } int main () { input(s, m, arr); int sum = 0; for (int i = 0; i < m; ++i) { sum += getNum(i); } cout << sum << endl; delete[] arr; }