結果
| 問題 |
No.341 沈黙の期間
|
| コンテスト | |
| ユーザー |
どらら
|
| 提出日時 | 2016-05-03 20:47:35 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 2,015 bytes |
| コンパイル時間 | 588 ms |
| コンパイル使用メモリ | 85,996 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-05 05:59:46 |
| 合計ジャッジ時間 | 1,306 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 11 |
ソースコード
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <iostream>
#include <queue>
#include <list>
#include <stack>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
class utf8_string {
std::vector<std::string> str;
int num_byte(const char &cc){
unsigned char c = static_cast<unsigned char>(cc);
if(c <= 0x7f) return 1;
if(0xc0 <= c && c <= 0xcf) return 2;
if(0xd0 <= c && c <= 0xdf) return 2;
if(0xe0 <= c && c <= 0xef) return 3;
if(0xf0 <= c && c <= 0xf7) return 4;
if(0xf8 <= c && c <= 0xfb) return 5;
return 6;
}
void init_str(const std::string &s){
for(size_t i=0; i<s.length();){
int n = num_byte(s[i]);
str.push_back(s.substr(i,n));
i += n;
}
}
public:
utf8_string(const std::string &s){ init_str(s); }
utf8_string(const char *p){
std::string s(p);
init_str(s);
}
size_t length() const { return str.size(); }
std::string operator[](size_t idx) const {
return str[idx];
}
bool operator==(const utf8_string &s){
if(length() != s.length()) return false;
for(size_t i=0; i<length(); i++){
if(str[i] != s[i]) return false;
}
return true;
}
std::string substr(size_t begin, size_t len){
std::string ret;
for(size_t i=begin; i<begin+len; i++){
if(i>=str.size()) break;
ret += str[i];
}
return ret;
}
};
int main(){
string str;
cin >> str;
string pat = "…";
utf8_string ustr(str);
utf8_string upat(pat);
int ret = 0;
int now = 0;
rep(i,ustr.length()){
if(ustr[i] == upat[0]){
now++;
ret = max(ret, now);
}else{
now = 0;
}
}
cout << ret << endl;
return 0;
}
どらら