結果
| 問題 |
No.203 ゴールデン・ウィーク(1)
|
| コンテスト | |
| ユーザー |
Maeda
|
| 提出日時 | 2025-03-10 10:27:06 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 495 bytes |
| コンパイル時間 | 465 ms |
| コンパイル使用メモリ | 25,728 KB |
| 実行使用メモリ | 7,324 KB |
| 最終ジャッジ日時 | 2025-03-10 10:27:08 |
| 合計ジャッジ時間 | 1,812 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 24 WA * 5 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:9:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
9 | scanf("%s\n",firstweek);
| ^~~~~~~~~~~~~~~~~~~~~~~
main.c:11:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
11 | scanf("%s\n",secondweek);
| ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/string.h:548,
from main.c:2:
In function ‘strncat’,
inlined from ‘main’ at main.c:13:15:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:138:10: warning: ‘__builtin___strncat_chk’ specified bound 1000 exceeds destination size 100 [-Wstringop-overflow=]
138 | return __builtin___strncat_chk (__dest, __src, __len,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
139 | __glibc_objsize (__dest));
| ~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#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