結果
問題 |
No.1534 おなかがいたい
|
ユーザー |
|
提出日時 | 2021-07-02 23:40:31 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 9 ms / 2,000 ms |
コード長 | 566 bytes |
コンパイル時間 | 2,228 ms |
コンパイル使用メモリ | 193,044 KB |
最終ジャッジ日時 | 2025-01-22 16:59:56 |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 19 |
ソースコード
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; ++i) typedef long long ll; using namespace std; int main() { string S; cin >> S; bool flag = false; int cnt = 0; rep(i, S.size()) { if (S.compare(i, 3, "pon") == 0) cnt++; else if (S.compare(i, 4, "pain") == 0) { flag = true; break; } } if (flag) { if (cnt < 2) cout << -1; else cout << cnt - 1; } else { cout << -1; } cout << endl; return 0; }