Run ID:76947
提交时间:2024-06-06 12:28:01
def generate_unique_three_digit_numbers(): digits = [2, 4, 6, 8] # List of available digits unique_numbers = [] # To store unique three-digit numbers for hundreds_digit in digits: for tens_digit in digits: if tens_digit != hundreds_digit: # Avoid repeating digits in tens and hundreds place for units_digit in digits: if units_digit != tens_digit and units_digit != hundreds_digit: # Avoid repeating digits three_digit_number = hundreds_digit * 100 + tens_digit * 10 + units_digit unique_numbers.append(three_digit_number) return unique_numbers def main(): unique_numbers = generate_unique_three_digit_numbers() #print("Unique three-digit numbers:") for number in unique_numbers: print(number) total_count = len(unique_numbers) #print("\nTotal unique three-digit numbers:", total_count) print(total_count) if __name__ == "__main__": main()