您的位置:首页 > 其它

题目1036:Old Bill

2013-12-22 15:32 309 查看
#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;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: