結果

問題 No.358 も~っと!門松列
ユーザー kichirb3
提出日時 2018-03-03 22:27:51
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 29 ms / 1,000 ms
コード長 713 bytes
コンパイル時間 132 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-07-04 19:09:46
合計ジャッジ時間 1,504 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

# -*- coding: utf-8 -*-
"""
No.358 も~っと!門松列
https://yukicoder.me/problems/no/358

"""
import sys
from sys import stdin
input = stdin.readline


def is_kadomatsu(A):
    if A[0] == A[1] or A[1] == A[2] or A[0] == A[2]:
        return False
    if max(A) != A[1] and min(A) != A[1]:
        return False
    return True


def main(args):
    ans = 0
    A = [int(x) for x in input().split()]
    if is_kadomatsu(A):
        print('INF')
    else:
        for p in range(1, max(A)+1):
            B = A[:]
            B[0] %= p
            B[1] %= p
            B[2] %= p
            if is_kadomatsu(B):
                ans += 1
        print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])
0