結果
| 問題 |
No.203 ゴールデン・ウィーク(1)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-12-09 20:06:40 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 1,000 ms |
| コード長 | 568 bytes |
| コンパイル時間 | 106 ms |
| コンパイル使用メモリ | 20,992 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-15 05:58:29 |
| 合計ジャッジ時間 | 944 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 29 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:15:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
15 | scanf("%s", week_1);
| ^~~~~~~~~~~~~~~~~~~
main.c:16:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
16 | 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;
scanf("%s", week_1);
scanf("%s", week_2);
strcpy(all_day, week_1);
strcat(all_day, week_2);
int tmp = 0;
for ( int 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;
}