版本比较
简单数论
正文
增加 6 行删除 6 行
66 行未改动676869707171727374757677757677787979808182837 行未改动919293949595969798995 行未改动66 行未改动void solve() { qa.clear(); qb.clear(); qc.clear();
cin >> a >> b >> c >> d; get_nums(a, qa); get_nums(b, qb); for (auto i : qa) for (auto j : qb)
for (auto i : qa) for (auto j : qb) qc.push_back(i * j);
for (auto q : qc) { // q是a*b的约数,x应该是q的倍数,y是剩余部分的倍数。 ll x = c / q * q; q = a*b / q;7 行未改动}
int main() { ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
int t; cin >> t; while (t--) solve(); return 0;5 行未改动