結果
| 問題 |
No.1987 Sandglass Inconvenience
|
| コンテスト | |
| ユーザー |
june19312
|
| 提出日時 | 2022-06-24 23:20:26 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 915 bytes |
| コンパイル時間 | 363 ms |
| コンパイル使用メモリ | 82,816 KB |
| 実行使用メモリ | 52,352 KB |
| 最終ジャッジ日時 | 2024-11-08 18:57:06 |
| 合計ジャッジ時間 | 2,075 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 WA * 5 |
ソースコード
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)
june19312