Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
文件
This repository doesn't specify license. Please pay attention to the specific project description and its upstream code dependency when using it.
Clone or Download
arrange.py 616 Bytes
Copy Edit Raw Blame History
dorabmon authored 2023-10-10 17:30 . 3rd test
# -*- coding: utf-8 -*-
"""
@Time : 2023/10/10 15:37
@Auth : dorabmon
@File :arrange.py
@IDE :PyCharm
"""
count = 0 # 计数器,用于统计符合条件的三位数的数量
# 使用嵌套循环生成所有可能的组合
for i in range(1, 5):
for j in range(1, 5):
for k in range(1, 5):
if i != j and j != k and i != k: # 确保三位数的数字互不相同
num = i * 100 + j * 10 + k # 计算三位数的值
print(num)
count += 1
# 输出符合条件的三位数的数量
print("符合条件的三位数共有", count, "个")
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化