結果

問題 No.1534 おなかがいたい
ユーザー トミートミー
提出日時 2024-04-13 17:32:13
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 386 bytes
コンパイル時間 374 ms
コンパイル使用メモリ 82,316 KB
実行使用メモリ 268,696 KB
最終ジャッジ日時 2024-04-13 17:32:18
合計ジャッジ時間 4,583 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
59,948 KB
testcase_01 AC 37 ms
53,280 KB
testcase_02 AC 36 ms
53,072 KB
testcase_03 AC 36 ms
53,448 KB
testcase_04 AC 36 ms
52,428 KB
testcase_05 AC 36 ms
52,008 KB
testcase_06 AC 36 ms
52,256 KB
testcase_07 AC 37 ms
52,204 KB
testcase_08 AC 40 ms
54,000 KB
testcase_09 AC 35 ms
52,880 KB
testcase_10 AC 37 ms
52,276 KB
testcase_11 AC 36 ms
52,616 KB
testcase_12 TLE -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    s = input()
    if s.find("pain") == -1:
        print(-1)
        exit()
    cnt = 0
    while True:
        if s[0:4] == "pain":
            break
        
        if s[0:3] == "pon":
            s = s[3:]
            cnt += 1
        else:
            s = s[1:]
        
    result = -1 if cnt < 2 else cnt-1
    print(result)


if __name__ == "__main__":
    main()
0