当前位置:网站首页>Output 1234 three digits without repetition
Output 1234 three digits without repetition
2022-07-29 07:35:00 【Beauty of algorithm and programming】
introduction
When solving mathematical permutations , Ask to give when encountering 1,2,3,4 When four numbers form repeated three digit numbers , Similar problems can be solved by programming , It can also verify whether the answer is correct .
1 problem
use 1,2,3,4 Four numbers form three digits without repetition , Find how many such numbers can be formed .
2 Method
Give a list first , The first cycle gets the first number , The second cycle gets the second number , The third cycle gets the third number , use if Conditional statements are used to judge whether the three numbers are repeated or equal , Then convert it to three digits , Add to list , Finally, output the list and get the result .
3 Experimental results and discussion
Through the experiment 、 Practice has proved that the proposed method is effective , Is able to solve the problem raised at the beginning .
Code list 1
| List=[] for i in range(1,5): for m in range(1,5): for i in range()1,5: if i!=m and i!=n and m!=n: x=(i*100+m*10+n) list.append() print(list) print(‘ Can generate %d individual ’%int(len(list))) |
4 Conclusion
Discussed 1234 How many non repeating three digits can be formed , involves for loop 、if Conditional judgment statements and conversion between strings , These knowledge points have been further consolidated , The result of permutation and combination by mathematical method is consistent with the result of the program , It is proved that this method is effective to solve this problem .
边栏推荐
- How can electronic component trading enterprises solve warehouse management problems with ERP system?
- OA项目之会议通知(查询&是否参会&反馈详情)
- Description of rollingfileappender attribute in logback
- Write some DP
- MapReduce各阶段步骤
- JS day 4 process control (if statement and switch statement)
- I'd like to ask, my flick job writes data in the way of upsert Kafka, but I'm more careful in MySQL
- 受欢迎的牛 G
- CFdiv1+2-Bash and a Tough Math Puzzle-(线段树单点区间维护gcd+总结)
- @Detailed explanation of requestmapping usage
猜你喜欢

Android interview question | how to write a good and fast log library?

分析25个主要DeFi协议的路线图 预见DeFi未来的七大趋势

10 practical uses of NFT

cs61abc分享会(六)程序的输入输出详解 - 标准输入输出,文件,设备,EOF,命令行参数

How does MySQL convert rows to columns?

QT基础第二天(2)qt基础部件:按钮类,布局类,输出类,输入类,容器等个别举例

【MYSQL】-【子查询】
![[summer daily question] Luogu p7760 [coci2016-2017 5] tuna](/img/9a/f857538c574fb54bc1accb737d7aec.png)
[summer daily question] Luogu p7760 [coci2016-2017 5] tuna

Practice of online problem feedback module (XVII): realize the online download function of excel template

halcon的安装以及在vs2017中测试,vs2017中dll的配置
随机推荐
关于大龄读博的几点回答?
【暑期每日一题】洛谷 P6336 [COCI2007-2008#2] BIJELE
LevelFilter简介说明
Blue Bridge Cup group a selection XOR
Scala higher order (IX): pattern matching in Scala
The beauty of do end usage
Leetcode buckle classic problem -- 4. Find the median of two positively ordered arrays
反射reflect
【WPF】通过动态/静态资源实现语言切换
写点dp
【暑期每日一题】洛谷 P6320 [COCI2006-2007#4] SIBICE
我,28岁,测试员,10月无情被辞:想给还在学测试 的人提个醒......
[MySQL] - [subquery]
Introduction and introduction of logback
国内数字藏品的乱象与未来
@RequestMapping 用法详解
BeanUtils.setProperty()
【无标题】格式保存
Zero technology is deeply involved in the development of privacy computing financial scenario standards of the ICT Institute
树莓派的启动流程