結果
問題 |
No.1005 BOT対策
|
ユーザー |
|
提出日時 | 2020-03-07 00:08:41 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 332 bytes |
コンパイル時間 | 427 ms |
コンパイル使用メモリ | 64,928 KB |
実行使用メモリ | 6,272 KB |
最終ジャッジ日時 | 2025-06-20 00:49:49 |
合計ジャッジ時間 | 1,284 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
コンパイルメッセージ
main.cpp:4:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type] 4 | main() | ^~~~
ソースコード
#include<iostream> using namespace std; string S,T; main() { cin>>S>>T; if(T.size()==1) { bool f=false; for(int i=0;i<S.size();i++)if(S[i]==T[0])f=true; cout<<(f?-1:0)<<endl; return 0; } int ans=0; for(int i=0;i<S.size();i++) { if(S.substr(i,T.size())==T) { ans++; i+=T.size()-2; } } cout<<ans<<endl; }