結果

問題 No.1534 おなかがいたい
ユーザー johnjohn
提出日時 2021-06-13 13:27:39
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 18 ms / 2,000 ms
コード長 881 bytes
コンパイル時間 484 ms
コンパイル使用メモリ 10,752 KB
実行使用メモリ 8,380 KB
最終ジャッジ日時 2023-08-24 15:34:22
合計ジャッジ時間 1,762 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,824 KB
testcase_01 AC 15 ms
7,844 KB
testcase_02 AC 15 ms
7,796 KB
testcase_03 AC 15 ms
7,824 KB
testcase_04 AC 15 ms
7,900 KB
testcase_05 AC 15 ms
7,852 KB
testcase_06 AC 15 ms
7,780 KB
testcase_07 AC 15 ms
7,736 KB
testcase_08 AC 15 ms
7,764 KB
testcase_09 AC 15 ms
7,780 KB
testcase_10 AC 15 ms
7,772 KB
testcase_11 AC 15 ms
7,796 KB
testcase_12 AC 17 ms
8,380 KB
testcase_13 AC 16 ms
8,272 KB
testcase_14 AC 16 ms
8,296 KB
testcase_15 AC 15 ms
8,336 KB
testcase_16 AC 18 ms
8,352 KB
testcase_17 AC 17 ms
8,300 KB
testcase_18 AC 18 ms
8,268 KB
testcase_19 AC 15 ms
8,312 KB
testcase_20 AC 17 ms
8,256 KB
testcase_21 AC 15 ms
7,796 KB
testcase_22 AC 15 ms
7,760 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding utf-8

# 文字列の取得
def Input_strData():
    return(input())

# 文字列内に 'pain' の文字があるか確認 
def Check_strData_in_pain_word(strData):
    return 'pain' in strData;

# 文字列を最初に 'pain' の文字列が出てくるところで切る
def Shaping_strData(strData):
    num = strData.find('pain')
    return strData[:num + 4]


# 文字列内に 'pon' がいくつあるか数える
def Count_strData_in_pon_word(strData):
    return strData.count('pon')

# メイン関数
def main():
    strData = Input_strData()
    SstrData = Shaping_strData(strData)
    flag = Check_strData_in_pain_word(SstrData)
    if flag == True:
        answer = Count_strData_in_pon_word(SstrData)
        if answer == 1:
            print(-1)
        else:
            print(answer - 1)
    else:
        print(-1)

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