#include <iostream>
using namespace std;
int A, B, f=0, n=0, c[4]={2, 3, 5, 6}; //A,B目标点数,标记f,剩余筛子数量n
void ss (int b, int n) { //当前状态b,剩余筛子数量n
if (b>=B || n<=0) {
if (b==B && !n) f=1;
return;
}
for (int i=0; i<4; i++ ) { //深搜
ss (b+c[i], n-1);
}
}
int main () {
cin >> A >> B;
n=3-A/4-A%4; //初始化n
ss(0, n);
if (f) cout << "Yes";
else cout << "No";
}
CCPC 山东 2023,签到题 Three Dice, 一道有趣的构造题
于 2024-01-31 16:51:47 首次发布