結果
| 問題 |
No.279 木の数え上げ
|
| コンテスト | |
| ユーザー |
sk3388607083
|
| 提出日時 | 2018-06-22 15:49:23 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 312 bytes |
| コンパイル時間 | 113 ms |
| コンパイル使用メモリ | 23,296 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-06-30 17:58:06 |
| 合計ジャッジ時間 | 1,039 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 21 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:8:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
8 | scanf("%s", S);
| ~~~~~^~~~~~~~~
main.cpp:7:8: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
7 | s[4] = '\0';
| ~~~~~^~~~~~
main.cpp:6:20: note: at offset 4 into destination object ‘s’ of size 4
6 | char S[1000001], s[4];
| ^
ソースコード
#include<stdio.h>
#include<string.h>
int main(void){
int i, n = 0;
char S[1000001], s[4];
s[4] = '\0';
scanf("%s", S);
for(i = 0; S[i+3] != '\0'; i++){
s[0] = S[i];
s[1] = S[i+1];
s[2] = S[i+2];
s[3] = S[i+3];
if(strcmp(s, "tree") == 0) n++;
}
printf("%d\n", n);
return 0;
}
sk3388607083