結果
| 問題 | No.203 ゴールデン・ウィーク(1) |
| コンテスト | |
| ユーザー |
Maeda
|
| 提出日時 | 2025-03-10 10:27:06 |
| 言語 | C (gcc 15.2.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 495 bytes |
| 記録 | |
| コンパイル時間 | 163 ms |
| コンパイル使用メモリ | 38,592 KB |
| 最終ジャッジ日時 | 2026-02-22 13:08:31 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | RE * 29 |
コンパイルメッセージ
main.c: In function 'main':
main.c:13:22: warning: 'strncat' specified bound 1000 exceeds destination size 100 [-Wstringop-overflow=]
13 | goldenWeek = strncat(firstweek, secondweek,(size_t)1000);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.c:8:14: note: destination object allocated here
8 | char firstweek[100] = "a";
| ^~~~~~~~~
ソースコード
#include <stdio.h>
#include <string.h>
#define MaxDay (14)
void main(void){
int longestDay = 0;
char firstweek[100] = "a";
scanf("%s\n",firstweek);
char secondweek[100] = "b";
scanf("%s\n",secondweek);
char *goldenWeek;
goldenWeek = strncat(firstweek, secondweek,(size_t)1000);
int count = 0;
for(int i = 0 ; i < MaxDay ; i++){
if(goldenWeek[i] == 'o'){
count++;
}else{
if(longestDay < count){
longestDay = count;
}
count = 0;
}
}
printf("%d\n",longestDay);
}
Maeda