結果
| 問題 |
No.203 ゴールデン・ウィーク(1)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-12-09 20:08:57 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 1,000 ms |
| コード長 | 572 bytes |
| コンパイル時間 | 222 ms |
| コンパイル使用メモリ | 21,376 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-18 09:36:14 |
| 合計ジャッジ時間 | 1,101 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 29 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:16:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
16 | scanf("%s", week_1);
| ^~~~~~~~~~~~~~~~~~~
main.c:17:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
17 | scanf("%s", week_2);
| ^~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
#include <string.h>
#define WEEK_LENGTH 8
#define MAX_LENGTH 16
int main(void)
{
//string関数の練習も兼ねてあえてこういう記述
char all_day[MAX_LENGTH];
char week_1[WEEK_LENGTH];
char week_2[WEEK_LENGTH];
int streak = 0;
int i;
scanf("%s", week_1);
scanf("%s", week_2);
strcpy(all_day, week_1);
strcat(all_day, week_2);
int tmp = 0;
for ( i = 0; i < 14; i++ ) {
if ( all_day[i] == 'o' ) {
tmp++;
if ( streak <= tmp ) {
streak = tmp;
}
} else {
tmp = 0;
}
}
printf("%d\n", streak);
return 0;
}