結果

問題 No.342 一番ワロタww
ユーザー kpinkcatkpinkcat
提出日時 2023-11-16 16:53:18
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 1,019 bytes
コンパイル時間 1,177 ms
コンパイル使用メモリ 112,528 KB
実行使用メモリ 6,548 KB
最終ジャッジ日時 2023-11-16 16:53:21
合計ジャッジ時間 2,564 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,548 KB
testcase_01 RE -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 2 ms
6,548 KB
testcase_05 WA -
testcase_06 AC 2 ms
6,548 KB
testcase_07 WA -
testcase_08 AC 2 ms
6,548 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 2 ms
6,548 KB
testcase_14 RE -
testcase_15 AC 2 ms
6,548 KB
testcase_16 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<algorithm>
#include<cctype>
#include<set>
#include<bitset>
#include<math.h>
#include<map>
#include<queue>
#include<iomanip>
using namespace std;
#ifdef _WIN32
#include <Windows.h>
#endif

int main()
{
    #ifdef _WIN32
        SetConsoleOutputCP(CP_UTF8);
        setvbuf(stdout, nullptr, _IOFBF, 1024);
    #endif
    int cnt = 0, max1 = 0;
    string s, t, tmp = "";
    cin >> s;
    t = "w";
    vector<string> ans;
    string::size_type pos = 0;
    while (s.begin() + pos != s.end()){
        if (s.substr(pos, 3) == t){
            cnt++;
            if (cnt > max1){
                max1 = cnt;
            }
        } else {
            if (cnt > 0) {
                if (cnt == max1) ans.push_back(tmp);
                tmp = "";
                cnt = 0;
            }
            tmp += s.substr(pos, 3);
        }
        pos += 3;
    }
    if (cnt == max1) ans.push_back(tmp);
    for (auto x : ans){
        cout << x << " ";
    }
    cout << endl;
    
}
0