結果
| 問題 | No.1534 おなかがいたい |
| コンテスト | |
| ユーザー |
_umbrella_kasa
|
| 提出日時 | 2021-06-06 18:33:00 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 8 ms / 2,000 ms |
| コード長 | 735 bytes |
| コンパイル時間 | 1,495 ms |
| コンパイル使用メモリ | 166,096 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-23 03:07:14 |
| 合計ジャッジ時間 | 2,381 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 19 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
string S;
cin >> S;
int N=S.size();
if (N<=9) {
cout << -1 << endl;
}
else {
int a=0;
for (int i=6; i<=N-4; i++) {
if (S[i]=='p' && S[i+1]=='a' && S[i+2]=='i' && S[i+3]=='n') {
a=i;
break;
}
}
if (a==0) {
cout << -1 << endl;
}
else {
int count=0;
for (int i=0; i<a; i++) {
if (S[i]=='p' && S[i+1]=='o' && S[i+2]=='n') {
count++;
}
}
if (count<=1) {
cout << -1 << endl;
}
else {
cout << count-1 << endl;
}
}
}
}
_umbrella_kasa