15 条题解
-
-2
标Turtle and Equations题解
思路
枚举 把所有方法都枚举出来就好了。
解题方法
没啥可说的,把所有情况都写出来
Code
#include <bits/stdc++.h> using namespace std; int main(){ int a, b, c, d; cin >> a >> b >> c >> d; if ((a + b) + c == d) cout << "Yes\n"; else if((a + b) - c == d) cout << "Yes\n"; else if((a + b) * c == d) cout << "Yes\n"; else if((a - b) + c == d) cout << "Yes\n"; else if((a - b) - c == d) cout << "Yes\n"; else if((a - b) * c == d) cout << "Yes\n"; else if((a * b) + c == d) cout << "Yes\n"; else if((a * b) - c == d) cout << "Yes\n"; else if((a * b) * c == d) cout << "Yes\n"; else cout << "No\n"; return 0; }
信息
- ID
- 25
- 时间
- 1000ms
- 内存
- 512MiB
- 难度
- 1
- 标签
- 递交数
- 1672
- 已通过
- 558
- 上传者