結果
| 問題 |
No.1005 BOT対策
|
| コンテスト | |
| ユーザー |
toto
|
| 提出日時 | 2025-04-01 10:20:09 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 420 bytes |
| コンパイル時間 | 525 ms |
| コンパイル使用メモリ | 28,032 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2025-04-01 10:20:12 |
| 合計ジャッジ時間 | 2,058 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 17 WA * 11 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:7:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
7 | scanf("%s",str);
| ~~~~~^~~~~~~~~~
main.cpp:10:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
10 | scanf("%s",target);
| ~~~~~^~~~~~~~~~~~~
ソースコード
#include <stdio.h>
#include <string.h>
int main(){
char str[1000];
scanf("%s",str);
int len = strlen(str);
char target[1000];
scanf("%s",target);
int targetlen = strlen(target);
int ans = 0;
for(int i = 0;i < len;i ++){
int count = 0;
for(int j = 0;j < targetlen;j ++){
if(str[i + j] != target[j]){
count++;
break;
}
}
if(count == 0){
ans++;
}
count = 0;
}
printf("%d",ans);
}
toto