結果

問題 No.965 門松列が嫌い
ユーザー titiatitia
提出日時 2020-02-05 18:53:58
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 453 bytes
コンパイル時間 500 ms
コンパイル使用メモリ 11,840 KB
実行使用メモリ 10,380 KB
最終ジャッジ日時 2023-10-24 03:20:52
合計ジャッジ時間 1,457 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

def kado(A,B,C):
    if A!=B and A!=C and B!=C and (max(A,B,C)==B or min(A,B,C)==B):
        return 1
    return 0

A,B,C=map(int,input().split())
S=sorted([A,B,C])
CAN=[S[2]-S[1],S[2]-S[0],S[1]-S[0]]
CAN2=[]
for i in CAN:
    for j in range(i-3,i+2):
        if j>=0:
            CAN2.append(j)

from itertools import product

P=list(product(CAN2,repeat=3))
ANS=1<<31

for x,y,z in P:
    if kado(A-x,B-y,C-z)==0:
        ANS=min(ANS,x+y+z)

print(ANS)
0