結果
問題 |
No.1005 BOT対策
|
ユーザー |
![]() |
提出日時 | 2025-04-01 10:23:15 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 439 bytes |
コンパイル時間 | 253 ms |
コンパイル使用メモリ | 28,160 KB |
実行使用メモリ | 7,328 KB |
最終ジャッジ日時 | 2025-04-01 10:23:17 |
合計ジャッジ時間 | 1,579 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 16 WA * 12 |
コンパイルメッセージ
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++; i += targetlen; } count = 0; } printf("%d",ans); }