結果
| 問題 | No.1534 おなかがいたい |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-09-23 18:05:08 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 7 ms / 2,000 ms |
| コード長 | 332 bytes |
| 記録 | |
| コンパイル時間 | 998 ms |
| コンパイル使用メモリ | 181,200 KB |
| 実行使用メモリ | 6,144 KB |
| 最終ジャッジ日時 | 2026-03-26 16:33:26 |
| 合計ジャッジ時間 | 1,838 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 19 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
string s;
int n = -1;
bool f;
int main()
{
cin >> s;
for (int i = 0; i < s.size(); i++) {
if (s.substr(i, 3) == "pon") {
n++;
i += 2;
}
else if (s.substr(i, 4) == "pain") {
f = 1;
break;
}
}
if (f && n > 0)
cout << n << endl;
else
cout << -1 << endl;
}