結果
| 問題 |
No.342 一番ワロタww
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-02-12 23:56:11 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 2,038 bytes |
| コンパイル時間 | 781 ms |
| コンパイル使用メモリ | 96,052 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-22 05:07:36 |
| 合計ジャッジ時間 | 1,420 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 WA * 4 |
ソースコード
#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;
int 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;
tmp_found = (int)found;
found+= 3;
}
// 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+3,from-tmp_found);
}
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 << hoge << endl;
if (hoge != "") ret.push_back(hoge);
}
else if (max_count == count) {
string hoge = findw(found-count*3,input);
// cout << 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;
}