結果

問題 No.1534 おなかがいたい
ユーザー Akisawa3Akisawa3
提出日時 2022-02-12 21:24:55
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 70 ms / 2,000 ms
コード長 317 bytes
コンパイル時間 496 ms
コンパイル使用メモリ 10,680 KB
実行使用メモリ 8,480 KB
最終ジャッジ日時 2023-09-11 09:44:19
合計ジャッジ時間 2,075 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,924 KB
testcase_01 AC 16 ms
7,872 KB
testcase_02 AC 16 ms
8,032 KB
testcase_03 AC 16 ms
7,812 KB
testcase_04 AC 15 ms
7,832 KB
testcase_05 AC 15 ms
7,776 KB
testcase_06 AC 16 ms
7,992 KB
testcase_07 AC 16 ms
7,872 KB
testcase_08 AC 15 ms
7,832 KB
testcase_09 AC 16 ms
7,872 KB
testcase_10 AC 16 ms
8,000 KB
testcase_11 AC 16 ms
7,944 KB
testcase_12 AC 59 ms
8,324 KB
testcase_13 AC 66 ms
8,304 KB
testcase_14 AC 68 ms
8,312 KB
testcase_15 AC 16 ms
8,348 KB
testcase_16 AC 68 ms
8,300 KB
testcase_17 AC 70 ms
8,480 KB
testcase_18 AC 70 ms
8,360 KB
testcase_19 AC 17 ms
8,384 KB
testcase_20 AC 63 ms
8,320 KB
testcase_21 AC 16 ms
7,908 KB
testcase_22 AC 16 ms
7,824 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

S = input()
ans = 0
p = ""
for s in S:
    if p == "pon":
        ans += 1
        p = ""
    elif p == "pain":
        break
    if s == "p" and p != "":
        p = ""
    p += s
else:
    if p != "pain":
        print(-1)
        exit()
if ans == 2:
    print(1)
elif ans <= 2:
    print(-1)
else:
    print(ans-1)
0