結果

問題 No.342 一番ワロタww
ユーザー satanicsatanic
提出日時 2016-05-14 03:15:24
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,706 bytes
コンパイル時間 1,399 ms
コンパイル使用メモリ 171,464 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-05 16:16:58
合計ジャッジ時間 2,142 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
#define INIT std::ios::sync_with_stdio(false);std::cin.tie(0);
#define VAR(type, a) type a;std::cin>>a;
// VAR(int, x);
#define OUT(d) std::cout<<(d);
#define SP std::cout<<" ";
#define ENDL std::cout<<"\n";
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define MAT(type, c, m, n) std::vector<std::vector<type>> c(m, std::vector<type>(n));for(auto& r:c)for(auto& i:r)std::cin>>i;
#define ALL(a) (a).begin(),(a).end()
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);--i)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)

using ll = long long;
ll Factrial(ll n){
    if(!n) return 1;
    return n*Factrial(n-1);
}

signed main(){
    INIT;
    VAR(std::string, s);
    std::string w = "w";
    std::vector<std::string> vecS;
    std::vector<int> wNum;
    std::string pre = "";
    std::string t = "";
    int cnt = 0;
    int maxCnt = 0;
    int beginNum = 0;
    for(; s.substr(beginNum, w.size())==w; beginNum+=w.size());
    for(int i=beginNum; i<s.size(); i+=w.size()){
        std::string now = s.substr(i, w.size());
        if(now==w && pre==w){
            ++cnt;
        }else if(now!=w && pre==w){
            vecS.push_back(t);
            wNum.push_back(cnt);
            maxCnt = std::max(maxCnt, cnt);
            cnt = 0;
            t = now;
        }else if(now!=w){
            t += now;
        }
        pre = now;
    }
    if(pre==w){
        vecS.push_back(t);
        wNum.push_back(cnt);
        maxCnt = std::max(maxCnt, cnt);
    }
    REP(i, wNum.size()){
        if(wNum[i]==maxCnt){
            OUT(vecS[i])ENDL;
        }
    }
    return 0;
}
0