class Program { static int[] numbers = { 1, 2, 5, 10, 30, 35, 45, 50, 70, 90, 100, 105, 300, 350, 500, 1000, 1050, 3000, 3500, 10000 }; static void Main(string[] args) { Console.WriteLine("请输入你要分解的数字:"); int number = int.Parse(Console.ReadLine()); if (number > 10000) { Console.WriteLine("最大的数字为10000,请从新输入:"); Console.WriteLine("请输入你要分解的数字:"); number = int.Parse(Console.ReadLine()); } int index = 0; while (true) { index = GetIndex(number); if (index == -1) { Console.WriteLine(number); break; } Console.WriteLine(numbers[index]); number = number - numbers[index]; } Console.ReadLine(); } static int GetIndex(int number) { for (int i = 0; i < numbers.Length; i++) { if (number == numbers[i]) { return -1; } if (number > numbers[i] && number < numbers[i + 1]) { return i; } } return -1; } }