結果
問題 | No.1534 おなかがいたい |
ユーザー |
![]() |
提出日時 | 2021-06-06 18:06:29 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 14 ms / 2,000 ms |
コード長 | 426 bytes |
コンパイル時間 | 576 ms |
コンパイル使用メモリ | 65,520 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-23 01:56:19 |
合計ジャッジ時間 | 1,436 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 19 |
ソースコード
#include <iostream> #include <string> using namespace std; int main(){ string s; cin >> s; int ans = 0; bool painexist = false; for(int i = 0; i < s.length(); i++){ if(s.substr(i, 4) == "pain"){ painexist = true; break; }else if(s.substr(i, 3) == "pon") ans++; } if(!painexist || ans < 2) cout << -1 << endl; else cout << ans-1 << endl; return 0; }