663 B
663 B
111. 构造二阶行列式
暴力模拟就好,每个数不超过 20, 暴力枚举其实也没多大。
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
for (int x = 1; x <= 20; x++) {
for (int y = 1; y <= 20; y++) {
for (int i = 1; i <= 20; i++) {
for (int j = 1; j <= 20; j++) {
if ((x * j - y * i) == n) {
cout << x << " " << y << endl;
cout << i << " " << j << endl;
return 0;
}
}
}
}
}
cout << -1 << endl;
}