結果
問題 |
No.1534 おなかがいたい
|
ユーザー |
![]() |
提出日時 | 2021-12-07 13:56:07 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 11 ms / 2,000 ms |
コード長 | 450 bytes |
コンパイル時間 | 2,089 ms |
コンパイル使用メモリ | 189,700 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-07 13:27:57 |
合計ジャッジ時間 | 3,259 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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; } }