题目链接 思路:枚举第一列的可能种数,然后递推即可,中途判断是否满足条件,最后再判断最后一列是否满足条件即可. #include<bits/stdc++.h> #define LL long long #define fi first #define se second #define mp make_pair #define pb push_back using namespace std; LL gcd(LL a,LL b){return b?gcd(b,a%b):a;} LL lcm(L…