返回题解分享
讨论 / 题解分享/ 帖子详情

卡片(结果填空) - 题解

public class Main {
	static int num[] = { 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021 };
	public static void main(String[] args) {

		for (int i = 1; true; i++) {
			if (!check(i)) {
				System.out.println(i - 1);
				return;
			}
		}
	}

	static boolean check(int n) {
		while (n > 0) {
			int tem = n % 10;
			if (num[tem] > 0) {
				num[tem]--;
			} else {
				return false;
			}
			n /= 10;
		}
		return true;
	}

}
0 回复 0 转发 0 喜欢 1 阅读
回复 (0)
默认 最新
暂无回复,快来抢沙发!