当前位置:网站首页>search--09
search--09
2022-08-10 12:06:00 【51CTO】
题目大概:
输入n组数据,Two four-digit prime numbers for each set of data.Let the first four-digit number change to the second four-digit number,Only one number can be changed per step,The changed number must also be a prime number,Ask at least a few steps to change can be successful.
思路:
用广度优先搜索.
Sift out all prime numbers first,方便判断,Then the four digits are changed one by one,Put the eligible numbers into the queue,until it becomes the second number,输出改变次数.
感想:
数据过多,Make a class of data into a structure,This makes it easier to queue,And if there are multiple queues,内存会不够.
代码:
边栏推荐
- LeetCode 86. 分隔链表
- 力扣练习——61 根据字符出现频率排序
- 做自媒体月入几万?博主们都在用的几个自媒体工具
- 制品库是什么?
- 三星计划2023年开始在越南生产半导体零部件
- LeetCode 138. 复制带随机指针的链表
- 中芯CIM国产化项目暂停?上扬软件:未停摆,改为远程开发!
- What are some useful performance testing tools recommended? Performance testing report charging standards
- SMIC CIM localization project suspended?Rising software: not shut down, changed to remote development!
- 皕杰报表在传参乱码
猜你喜欢
第六届”蓝帽杯“全国大学生网络安全技能大赛半决赛部分WriteUp
英特尔推送20220809 CPU微码更新 修补Intel-SA-00657安全漏洞
Do self-media monthly income tens of thousands?Several self-media tools that bloggers are using
你有一份斗破苍穹词库,请查收
mpf6_Time Series Data_quandl_correct kernel PCA_AIC_BIC_trend_log_return_seasonal_decompose_sARIMAx_ADFull
嘉为蓝鲸荣获工信部“数字技术融合创新应用解决方案”
一文详解 implementation api embed
再有人问你分布式事务,把这篇扔给他
APP automation testing practice based on UiAutomator2+PageObject mode
微信小程序,全局变量一个地方改变了其他地方的状态也跟着改变。
随机推荐
LeetCode 138. 复制带随机指针的链表
暑期总结4
LeetCode 109. Sorted Linked List Conversion Binary Search Tree
LeetCode 25. K 个一组翻转链表
mpf6_Time Series Data_quandl_更正kernel PCA_AIC_BIC_trend_log_return_seasonal_decompose_sARIMAx_ADFull
LeetCode50天刷题计划(Day 17—— 下一个序列(14.50-16.30)
Servlet---解决post请求中中文乱码问题
Excel函数公式大全—LOOKUP函数
中芯CIM国产化项目暂停?上扬软件:未停摆,改为远程开发!
Where can I view the version record of WeChat applet submission review history?
Nocalhost - 让云原生时代的开发更高效
基于UiAutomator2+PageObject模式开展APP自动化测试实战
It is rumored that Samsung 3nm has won the second customer, and the current production capacity is in short supply
态路小课堂丨如何为CXP光模块选择光纤跳线?
LeetCode 92. Reverse Linked List II
VSCode远程连接服务器报错:Could not establish connection to “xxxxxx”的可能错误原因及解决
Licking Exercise - 63 Find all anagrams in a string
ssm框架搭建过程[通俗易懂]
搜索--01
彩色图和深度图转点云