题解 | #Old Bill#
Old Bill
https://www.nowcoder.com/practice/17a30153e092493e8b4d13f321343927
#include <iostream> using namespace std; void turkey(int n, int x, int y, int z){ for(int a = 9; a >= 1; a --){ for (int b = 9; b >= 0; b --) { int p = a * 10000 + x * 1000 + y * 100 + z * 10 + b; if(p % n == 0){ cout << a << ' ' << b << ' ' << p / n<< endl; return ; } } } cout << 0 << endl; } int main() { int n, x, y, z; while(cin >> n >> x >> y >> z){ turkey(n, x, y, z); } return 0; }