結果
問題 | No.342 一番ワロタww |
ユーザー | dosuken123 |
提出日時 | 2016-02-13 00:13:14 |
言語 | C++11 (gcc 11.4.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,116 bytes |
コンパイル時間 | 796 ms |
コンパイル使用メモリ | 97,188 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-22 05:08:50 |
合計ジャッジ時間 | 1,391 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | AC | 2 ms
6,944 KB |
testcase_03 | AC | 1 ms
6,940 KB |
testcase_04 | AC | 2 ms
6,944 KB |
testcase_05 | AC | 1 ms
6,944 KB |
testcase_06 | AC | 1 ms
6,944 KB |
testcase_07 | AC | 1 ms
6,944 KB |
testcase_08 | AC | 2 ms
6,940 KB |
testcase_09 | AC | 2 ms
6,944 KB |
testcase_10 | AC | 2 ms
6,940 KB |
testcase_11 | AC | 2 ms
6,944 KB |
testcase_12 | AC | 1 ms
6,940 KB |
testcase_13 | AC | 1 ms
6,944 KB |
testcase_14 | AC | 2 ms
6,944 KB |
testcase_15 | AC | 1 ms
6,940 KB |
testcase_16 | WA | - |
ソースコード
#include <cstdlib> #include <cctype> #include <cstring> #include <cstdio> #include <cmath> #include <algorithm> #include <vector> #include <string> #include <iostream> #include <sstream> #include <map> #include <set> #include <queue> #include <stack> #include <fstream> #include <numeric> #include <iomanip> #include <bitset> #include <list> #include <stdexcept> #include <functional> #include <utility> #include <ctime> using namespace std; string findw(size_t from, string input) { std::size_t found = 0; std::size_t tmp_found = 0; // cout << "from-found+3 = " << (from-found+3) << " from = " << from << endl; while ((found = input.find("w",found))!=std::string::npos && (found<from)) { // cout << "found = " << found << " from = " << from << endl; found += 3; tmp_found = found; } // cout << "tmp_found = " << tmp_found << endl; // if (found ==std::string::npos) found = 0; // if (tmp_found == 0) tmp_found -= 3; return input.substr(tmp_found,from-tmp_found+3); } int main(int argc, const char * argv[]) { string input; cin >> input; std::size_t found = 0; std::size_t tmp_found = 0; int count = 0; int max_count = 0; vector<string> ret; while ((found = input.find("w",found))!=std::string::npos) { // cout << found << endl; if (tmp_found+3 == found) count++; else count = 1; if (count > max_count) { ret.clear(); max_count = count; string hoge = findw(found-count*3,input); // cout << "found = " << found << "hoge = " << hoge << endl; if (hoge != "") ret.push_back(hoge); } else if (max_count == count) { string hoge = findw(found-count*3,input); // cout << "found = " << found << "hoge = " << hoge << endl; if (hoge != "") ret.push_back(hoge); } tmp_found = found; found += 3; } for (int i = 0; i < ret.size(); i++) { cout << ret[i] << endl; } if (ret.size() == 0) cout << "" << endl; return 0; }