結果

問題 No.632 穴埋め門松列
ユーザー mossari_aozoramossari_aozora
提出日時 2019-10-02 15:11:28
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 31 ms / 1,000 ms
コード長 637 bytes
コンパイル時間 89 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-04-14 08:57:22
合計ジャッジ時間 907 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,752 KB
testcase_01 AC 31 ms
10,752 KB
testcase_02 AC 29 ms
10,752 KB
testcase_03 AC 29 ms
10,752 KB
testcase_04 AC 29 ms
10,880 KB
testcase_05 AC 28 ms
10,880 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve():
    li = []
    line = input().split(' ')
    for i in range(3):
        if (line[i] == '?'):
            n = 0
        else:
            n = int(line[i])
        li.append(n)
    if (isKadomatsu(li, 1) and isKadomatsu(li, 4)):
        print(14)
    elif (isKadomatsu(li, 1)):
        print(1)
    elif (isKadomatsu(li, 4)):
        print(4)


def isKadomatsu(li, n):
    a = li[0] if li[0] != 0 else n
    b = li[1] if li[1] != 0 else n
    c = li[2] if li[2] != 0 else n

    if (a < b and c < b and a != b != c):
        return True
    if (a > b and c > b and a != b != c):
        return True
    return False


solve()
0