Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
76947 | 胡海峰老师 | 排列组合 | Python3 | Accepted | 31 MS | 3764 KB | 1037 | 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()