题解:P15086 [UOI 2025 II Stage] A+B=C
Nostopathy · · 题解
枚举
#include <bits/stdc++.h>
using namespace std;
int seg[10] = {6, 2, 5, 5, 4, 5, 6, 3, 7, 6};
int main() {
int a, b, c;
cin >> a >> b >> c;
int s = seg[a] + seg[b];
bool ok = 0;
for (int x = 0; x <= 9; x++) {
int y = c - x;
if (y < 0 || y > 9) continue;
if (seg[x] + seg[y] == s) {
ok = 1;
break;
}
}
cout << (ok ? "Yes" : "No");
return 0;
}