結果
| 問題 | No.1987 Sandglass Inconvenience |
| コンテスト | |
| ユーザー |
june19312
|
| 提出日時 | 2022-06-24 23:20:26 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 915 bytes |
| 記録 | |
| コンパイル時間 | 291 ms |
| コンパイル使用メモリ | 84,976 KB |
| 実行使用メモリ | 54,408 KB |
| 最終ジャッジ日時 | 2026-05-08 21:10:19 |
| 合計ジャッジ時間 | 2,421 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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