結果
| 問題 |
No.1534 おなかがいたい
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-09-09 17:07:17 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 15 ms / 2,000 ms |
| コード長 | 450 bytes |
| コンパイル時間 | 2,543 ms |
| コンパイル使用メモリ | 188,536 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-30 18:34:10 |
| 合計ジャッジ時間 | 3,918 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 19 |
ソースコード
#define _GLIBCXX_DEBUG
#define ll long long
#include <bits/stdc++.h>
using namespace std;
int main() {
string S; cin >> S;
int s = S.find("pain");
if(s != -1){
string T = S.substr(0, s);
int ans = 0;
for(int i = 0; i < (int)T.size()-2; i++){
string U = "";
U += T[i]; U += T[i+1]; U += T[i+2];
if(U == "pon") ans++;
}
if(ans < 2) ans = 0;
cout << ans-1 << endl;
}else{
cout << s << endl;
}
}