結果
| 問題 |
No.342 一番ワロタww
|
| コンテスト | |
| ユーザー |
asi1024
|
| 提出日時 | 2016-02-19 22:03:12 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 804 bytes |
| コンパイル時間 | 1,580 ms |
| コンパイル使用メモリ | 166,248 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-15 13:21:16 |
| 合計ジャッジ時間 | 2,258 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 14 |
ソースコード
#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;
}
asi1024