CF 271A - Beautiful Year
It seems like the year of 2013 came only yesterday. Do you know a curious fact? The year of 2013 is the first year after the old 1987 with only distinct digits.
Now you are suggested to solve the following problem: given a year number, find the minimum year number which is strictly larger than the given one and has only distinct digits.
Input
The single line contains integer y (1000 ≤ y ≤ 9000) — the year number.
Output
Print a single integer — the minimum year number that is strictly larger than y and all it's digits are distinct. It is guaranteed that the answer exists.
---------------------------------------------------------------
2013年仿佛就在昨天。 你知道一个奇怪的事实吗? 2013 年是 1987 年之后的第一年,只有不同的数字。
现在建议您解决以下问题:给定一个年份数字,找到严格大于给定年份且只有不同数字的最小年份数字。
输入
单行包含整数 y (1000 ≤ y ≤ 9000) — 年份数。
输出
打印一个整数——严格大于 y 的最小年份数,并且它的所有数字都是不同的。 保证答案存在。
--------------------------------------------
while循环+函数判断即可;
下面是代码: