結果

問題 No.358 も~っと!門松列
ユーザー kichirb3kichirb3
提出日時 2018-03-03 22:27:51
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 17 ms / 1,000 ms
コード長 713 bytes
コンパイル時間 92 ms
コンパイル使用メモリ 10,784 KB
実行使用メモリ 7,996 KB
最終ジャッジ日時 2023-09-18 02:20:48
合計ジャッジ時間 1,944 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,800 KB
testcase_01 AC 16 ms
7,948 KB
testcase_02 AC 16 ms
7,832 KB
testcase_03 AC 16 ms
7,892 KB
testcase_04 AC 16 ms
7,892 KB
testcase_05 AC 17 ms
7,856 KB
testcase_06 AC 16 ms
7,808 KB
testcase_07 AC 16 ms
7,868 KB
testcase_08 AC 16 ms
7,976 KB
testcase_09 AC 17 ms
7,804 KB
testcase_10 AC 16 ms
7,960 KB
testcase_11 AC 16 ms
7,996 KB
testcase_12 AC 16 ms
7,852 KB
testcase_13 AC 16 ms
7,812 KB
testcase_14 AC 16 ms
7,800 KB
testcase_15 AC 15 ms
7,944 KB
testcase_16 AC 16 ms
7,848 KB
testcase_17 AC 15 ms
7,792 KB
testcase_18 AC 16 ms
7,776 KB
testcase_19 AC 16 ms
7,800 KB
testcase_20 AC 17 ms
7,804 KB
testcase_21 AC 16 ms
7,940 KB
testcase_22 AC 16 ms
7,728 KB
権限があれば一括ダウンロードができます

ソースコード

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