A. [GESP202309 二级]数字黑洞

    Type: Default 1000ms 256MiB

[GESP202309 二级]数字黑洞

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

题目描述

给定一个三位数,要求各位不能相同。例如352352 是符合要求的, 112112是不符合要求的。

将这个三位数的三个数字重 新排列,得到的最大的数,减去得到的最小的数,形成一个新的三位数。

对这个新的三位数可以重复上述过程。神 奇的是,最终一定会得到 495495

试试看,重新排列352352 ,得到的最大数为532532 ,最小数为 235235,它们的差是297297 ;变换297297 ,得到 972279=693972-279=693;变换693693963369=594963-369=594;变换594954459=495594 ,954-459=495

因此,354354 经过44次变换得到了 495495

现在,输入的三位数,你能通过编程得出,这个三位数经过多少次变换能够得到495495吗?

输入描述

输入一行,包含一个符合要求的三位数NN

输出描述

输出一行,包含一个整数CC ,表示经过CC次变换得到495495

352
4

循环嵌套评测

Not Attended
Status
Done
Rule
IOI
Problem
3
Start at
2026-3-7 14:30
End at
2026-3-17 14:30
Duration
240 hour(s)
Host
Partic.
5