結果
| 問題 |
No.204 ゴールデン・ウィーク(2)
|
| コンテスト | |
| ユーザー |
FF256grhy
|
| 提出日時 | 2015-05-08 23:21:17 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 593 bytes |
| コンパイル時間 | 103 ms |
| コンパイル使用メモリ | 22,912 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-13 11:52:41 |
| 合計ジャッジ時間 | 1,242 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 WA * 23 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:8:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
8 | scanf("%d%s%s", &d, c, &c[7]);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
int note[16];
int main(void) {
int d;
char c[15];
scanf("%d%s%s", &d, c, &c[7]);
c[14] = 'x';
int kinou = 'x', cnt = 0;
note[0] = 15;
int i;
for(i = 0; i < 15; i++) {
if(kinou != c[i]) {
cnt++;
}
note[cnt]++;
kinou = c[i];
}
note[cnt] += 15;
int max = d;
for(i = 1; i < cnt - 1; i += 2) {
int len;
len = note[i] + ( note[i - 1] <= d ? note[i - 1] + note[i - 2] : d );
if(max < len) { max = len; }
len = note[i] + ( note[i + 1] <= d ? note[i + 1] + note[i + 2] : d );
if(max < len) { max = len; }
}
printf("%d\n", max);
return 0;
}
FF256grhy