結果

問題 No.1534 おなかがいたい
ユーザー mmn15277198
提出日時 2021-06-08 21:12:35
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 463 bytes
コンパイル時間 1,446 ms
コンパイル使用メモリ 167,544 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-27 04:09:21
合計ジャッジ時間 2,601 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 14 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int ans = 0;
  bool ok = false;
  for (int i = 0; i < s.size(); i++) {
    if (i + 3 < s.size() && s[i] == 'p' && s[i + 1] == 'a' && s[i + 2] == 'i' && s[i + 3] == 'n') {
      ok = true;
      break;
    }
    if (s[i] == 'p' && s[i + 1] == 'o' && s[i + 2] == 'n') {
      ans++;
    }
  }
  if (ok) ans = max(ans - 1 , 0);
  else ans = -1;
  cout << ans << endl;
  return 0;
}
0