結果
| 問題 |
No.341 沈黙の期間
|
| コンテスト | |
| ユーザー |
alpha_virginis
|
| 提出日時 | 2016-02-12 22:24:58 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 940 bytes |
| コンパイル時間 | 555 ms |
| コンパイル使用メモリ | 66,604 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-22 04:20:48 |
| 合計ジャッジ時間 | 1,160 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 11 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:32:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
32 | scanf("%s", str);
| ~~~~~^~~~~~~~~~~
ソースコード
#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