結果

問題 No.342 一番ワロタww
ユーザー asi1024asi1024
提出日時 2016-02-19 22:03:12
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 804 bytes
コンパイル時間 1,266 ms
コンパイル使用メモリ 152,672 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-05 16:14:13
合計ジャッジ時間 2,152 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()

using namespace std;

vector<string> utf8(string str) {
  vector<string> res;
  int n = 0;
  for (int i = 0; i < (int)str.size(); i += n) {
    n = 1; unsigned char c = str[i];
    n += (c >= 0x80); n += (c >= 0xE0); n += (c >= 0xF0);
    res.push_back(str.substr(i, n));
  }
  return res;
}

int main() {
  string str; cin >> str; str += "あ";
  int n = 0, ma = 0;
  vector<string> res;
  string s;
  for (string c: utf8(str)) {
    if (c == "w") ++n;
    else {
      if (n > 0 && !s.empty()) {
        if (n > ma) { ma = n; res = {s}; }
        else if (n == ma) res.push_back(s);
        s = "";
      }
      n = 0; s += c;
    }
  }
  for (auto s: res) cout << s << endl;
  return 0;
}
0