【MX-J2-T0】Turtle and Equations

Luogu
IDLGP10839
Time1000ms
Memory512MB
DifficultyP1
模拟O2优化枚举梦熊比赛
给你四个正整数 $a, b, c, d$。 现在你有一条算式 $(a\ \Box\ b)\ \Box\ c$。你需要判断能否在两个方框内分别填入三种运算符 $+, -, \times$ 之一(运算符可以重复使用),使得算式运算的结果等于 $d$。 ## Input 第一行包含四个正整数 $a, b, c, d$。 ## Output 如果能使得运算结果等于 $d$,输出 `Yes`,否则输出 `No`。 [samples] ## Background 原题链接:<https://oier.team/problems/J2A>。 ## Note #### 【样例解释 #1】 因为 $(1 + 1) + 1 = 3$,可以在第一个方框内填入 $+$,第二个方框内填入 $+$。 #### 【样例解释 #2】 因为 $(5 - 2) \times 9 = 27$,可以在第一个方框内填入 $-$,第二个方框内填入 $\times$。 #### 【样例解释 #3】 无论填什么运算符都不能使得算式的结果为 $514$。 #### 【数据范围】 对于所有数据,满足 $1 \le a, b, c \le 10$,$1 \le d \le 1000$。
Samples
Input #1
1 1 1 3
Output #1
Yes
Input #2
5 2 9 27
Output #2
Yes
Input #3
1 1 4 514
Output #3
No
API Response (JSON)
{
  "problem": {
    "name": "【MX-J2-T0】Turtle and Equations",
    "description": {
      "content": "给你四个正整数 $a, b, c, d$。 现在你有一条算式 $(a\\ \\Box\\ b)\\ \\Box\\ c$。你需要判断能否在两个方框内分别填入三种运算符 $+, -, \\times$ 之一(运算符可以重复使用),使得算式运算的结果等于 $d$。",
      "description_type": "Markdown"
    },
    "platform": "Luogu",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 524288
    },
    "difficulty": {
      "LuoguStyle": "P1"
    },
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "LGP10839"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "给你四个正整数 $a, b, c, d$。\n\n现在你有一条算式 $(a\\ \\Box\\ b)\\ \\Box\\ c$。你需要判断能否在两个方框内分别填入三种运算符 $+, -, \\times$ 之一(运算符可以重复使用),使得算式运算的结果等于 $d$。\n\n## Input\n\n第一行包含四个正整数 $a, b, c, d$。\n\n## Output\n\n如果能使得运算结果等于 $d$,输出 `Yes`,否则...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments