题解 | #Old Bill#
Old Bill
https://www.nowcoder.com/practice/17a30153e092493e8b4d13f321343927
#include <iostream>
#include<stdio.h>
using namespace std;
int main()
{
int num, i, j, k;
while (scanf("%d", &num)!=EOF)
{
int temp1 = 0;
int temp2 = 0;
int max = 0;
scanf("%d %d %d", &i, &j, &k);
for (int p = 1; p < 10; p++)
{
for (int q = 0; q < 10; q++)
{
int temp = p * 10000 + i * 1000 + j * 100 + k * 10 + q;
if (temp % num == 0)
{
int temp3 = temp / num;
if (temp3 > max)
{
temp1 = p;
temp2 = q;
max = temp3;
}
}
}
}
if (max == 0)
{
printf("%d\n", max);
}
else
{
printf("%d %d %d\n", temp1, temp2, max);
}
}
}

