結果
| 問題 | No.341 沈黙の期間 |
| コンテスト | |
| ユーザー |
alpha_virginis
|
| 提出日時 | 2016-02-12 22:24:58 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 940 bytes |
| 記録 | |
| コンパイル時間 | 410 ms |
| コンパイル使用メモリ | 88,944 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-04-10 09:44:53 |
| 合計ジャッジ時間 | 1,176 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 11 |
ソースコード
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <algorithm>
#include <string.h>
void u8toi(char *str, int *array) {
int i;
int n = strlen(str);
for(i = 0; i < n; ++i) {
int flag = str[i];
int mask = ~flag;
mask |= (mask >> 1);
mask |= (mask >> 2);
mask |= (mask >> 4);
int res = str[i] & mask;
while( 0xC0 <= (unsigned char)flag ) {
i += 1;
flag <<= 1;
res <<= 6;
res |= str[i] & 0x3F;
}
*array++ = res;
}
*array++ = 0;
}
int main() {
char str[1000];
scanf("%s", str);
int str2[1000];
u8toi(str, str2);
char t[10] = "…";
int t2[10];
u8toi(t, t2);
int c = t2[0];
int res = 0;
int temp = 0;
for(int i = 0; str2[i] != 0; ++i) {
if( str2[i] == c ) {
temp += 1;
}
else {
temp = 0;
}
res = std::max(temp, res);
}
std::cout << res << std::endl;
return 0;
}
alpha_virginis