问题描述:
给出a,b,c(3个整数),判断a,b能否通过+-*/得到c,ab可以交换位置,可以输出YES,不行输出NO
样例输入:
输入:
3 8 2
输出:
NO
代码:
#include <cstdio>
int main(){
int a, b, c;
scanf("%d%d%d", &a, &b, &c);
int flag = 0;
if(a + b == c) flag = 1;
else if(a - b == c) flag = 1;
else if(b - a == c) flag = 1;
else if(a * b == c) flag = 1;
else if(a / b == c && a % b == 0) flag = 1;
else if(b / a == c && b % a == 0) flag = 1;
if(flag == 0) printf("NO\n");
else printf("YES\n");
return 0;
}