結果
問題 |
No.1534 おなかがいたい
|
ユーザー |
|
提出日時 | 2021-06-06 18:12:40 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 345 bytes |
コンパイル時間 | 1,578 ms |
コンパイル使用メモリ | 167,100 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-23 02:12:44 |
合計ジャッジ時間 | 2,429 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 17 WA * 2 |
ソースコード
#include<bits/stdc++.h> using namespace std; int main(){ string T; cin>>T; auto itp=T.find("pain"); if(itp==string::npos){ cout<<"-1\n"; return 0; } int ans=0; for(auto i=T.begin();i-T.begin()<itp;i++){ if(*i=='p'&&*(i+1)=='o'&&*(i+2)=='n')ans++; } if(ans<1){ cout<<"-1\n"; }else{ cout<<ans-1<<'\n'; } }