結果

問題 No.1987 Sandglass Inconvenience
ユーザー june19312june19312
提出日時 2022-06-24 23:20:26
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 915 bytes
コンパイル時間 156 ms
コンパイル使用メモリ 82,244 KB
実行使用メモリ 52,736 KB
最終ジャッジ日時 2024-04-26 06:05:41
合計ジャッジ時間 1,894 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
52,352 KB
testcase_01 AC 36 ms
52,096 KB
testcase_02 AC 38 ms
52,480 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 37 ms
52,736 KB
testcase_07 AC 37 ms
52,480 KB
testcase_08 AC 37 ms
52,096 KB
testcase_09 AC 35 ms
52,224 KB
testcase_10 AC 37 ms
52,224 KB
testcase_11 AC 40 ms
52,736 KB
testcase_12 AC 37 ms
52,224 KB
testcase_13 AC 38 ms
51,968 KB
testcase_14 AC 36 ms
52,224 KB
testcase_15 WA -
testcase_16 AC 38 ms
52,096 KB
testcase_17 AC 37 ms
52,352 KB
testcase_18 WA -
testcase_19 AC 36 ms
52,352 KB
testcase_20 AC 38 ms
52,352 KB
testcase_21 AC 38 ms
52,096 KB
testcase_22 AC 37 ms
52,464 KB
testcase_23 AC 37 ms
52,608 KB
testcase_24 AC 38 ms
52,096 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools

a,b,c = map(str,input().split())
X = int(input())
tmp = [int(a),int(b),int(c)]

for i in itertools.permutations([a,b,c],2):
    for j in itertools.product(["+","-"],repeat = 1):
        if j == "+":
            tmp.append(int(i[0])+int(i[1]))
        else:
            tmp.append(abs(int(i[0])-int(i[1])))

for i in itertools.permutations([a,b,c],3):
    for j in itertools.product(["+","-"],repeat = 2):
        if j[0] == j[1] == "+":
            tmp.append(int(i[0])+int(i[1])+int(i[2]))
        elif j[0] == j[1] == "-":
            tmp.append(abs(int(i[0])-int(i[1])-int(i[2])))
        elif j[0] == "+" and j[1] == "-":
            tmp.append(abs(int(i[0])+int(i[1])-int(i[2])))
        elif j[0] == "-" and j[1] == "+":
            tmp.append(abs(int(i[0])-int(i[1])+int(i[2])))

#print(tmp)

ans = "No"
for i,v in enumerate(tmp):
    if v != 0 and X%v == 0:
        ans = "Yes"

print(ans)
0