#include <iostream>
#include <fstream>
#include <cstring>
using namespace std;
int find(int x);
int main()
{
int x, y, z, n;
#ifndef ONLINE_JUDGE
ifstream cin("d:\\OJ\\uva_in.txt");
#endif // ONLINE_JUDGE
while (cin >> n >> x >> y >> z) {
int tmp = x * 1000 + y * 100 + z * 10;
bool found = false;
for (int i = 9; i >= 1; i--) {
for (int j = 9; j >= 0; j--) {
int sum = i * 10000 + tmp + j;
if (sum % n == 0) {
cout << i << " " << j << " " << sum / n << endl;
i = 1;
found = true;
break;
}
}
}
if (!found) cout << 0 << endl;
}
return 0;
}
题目1036:Old Bill
最新推荐文章于 2021-11-30 12:50:14 发布