当前位置: 首页 > news >正文

阳信网站建设合肥网站维护公司

阳信网站建设,合肥网站维护公司,app开发手机版,长沙互联网公司招聘题目:03879 * 203879 41566646641这有什么神奇呢?仔细观察,203879 是个6位数,并且它的每个数位上的数字都是不同的,并且它平方后的所有数位上都不出现组成它自身的数字。具有这样特点的6位数还有一个,请你…

题目:

03879 * 203879 = 41566646641

这有什么神奇呢?仔细观察,203879 是个6位数,并且它的每个数位上的数字都是不同的,并且它平方后的所有数位上都不出现组成它自身的数字。

具有这样特点的6位数还有一个,请你找出它!

再归纳一下筛选要求:

  1. 6位正整数

  1. 每个数位上的数字不同

  1. 其平方数的每个数位不含原数字的任何组成数位

分析:

仔细分析题目,我们得知两个点,

1,这个六位数的每一位数都不一样

2,这个六位数的平方的每位数字跟六位数的每位数字都不一样

那么我们就可以建一个遍历最小六位数到最大六位数的循环,建两个嵌套的if,第一个if用来判断1第二个if用来判断2。

第一个if需要把int转数组并赋值,然后进行循环比较如果没有相等的直接进入第二个if

第二个if参考值一个是六位数,一个是六位数的平方。

六位数的平方先转为字符串,然后建一个数组并遍历赋值,六位数也是转为字符串,然后建一个数组并遍历赋值。两个数组出来了,然后两个嵌套循环进行比对

解析:

注意:因为六位数平方很大,我们需要建Bigdecimal来表示数字

package 刷提210;import java.math.BigDecimal;public class 排他平方数 {public static void main(String[] args) {for (int i = 100000; i < 1000000; i++) {if (!panduan(i)) {//第一个判断,判断在所有可能中,自身所有的位数不重复BigDecimal six = new BigDecimal(i);//表示六位数String six2 = six.multiply(six).toString();//表示六位数的平方if (!panduan2(six2, six)) {//第二个判断,满足第一个判断的情况,六位数跟他的平方没有重复的System.out.println(six);}}}}public static boolean panduan(int num) {int[] store = new int[6];//长度为6数组String midStr = String.valueOf(num);//Int转为stringfor (int i = 0; i < midStr.length(); i++) {//把字符串遍历到数组里store[i] = midStr.charAt(i);}for (int i = 0; i < store.length; i++) {//两个循环用来判断自身有没有重复数值for (int j = i+1; j < store.length; j++) {if (store[i] == store[j]) {return true;}}}return false;}public static boolean panduan2(String str, BigDecimal num) {int[] PingStore = new int[str.length()];for (int i = 0; i < str.length(); i++) {//把string建数组并遍历赋值PingStore[i] = str.charAt(i);}String numStr = num.toString();//把BigDecimal转为stringint[] midNum = new int[6];for (int i = 0; i < numStr.length(); i++) {//建一个长度为6的数组并把string的每个数值遍历赋值midNum[i] = numStr.charAt(i);}for (int i = 0; i < 6; i++) {for (int j = 0; j < PingStore.length; j++) {//六位数跟他的平方数组进行比较只要有一个重复直接结束if (midNum[i] == PingStore[j]) {return true;}}}return false;}}

文章转载自:
http://wtp.xzLp.cn
http://keratometer.xzLp.cn
http://involvement.xzLp.cn
http://bassoonist.xzLp.cn
http://gasolier.xzLp.cn
http://rollout.xzLp.cn
http://gloatingly.xzLp.cn
http://turkish.xzLp.cn
http://sandhill.xzLp.cn
http://flagman.xzLp.cn
http://mesalliance.xzLp.cn
http://songster.xzLp.cn
http://nepalese.xzLp.cn
http://cernuous.xzLp.cn
http://yezo.xzLp.cn
http://selma.xzLp.cn
http://computation.xzLp.cn
http://seedily.xzLp.cn
http://haggish.xzLp.cn
http://poud.xzLp.cn
http://hieroglyph.xzLp.cn
http://sulfurize.xzLp.cn
http://fibroin.xzLp.cn
http://excrescence.xzLp.cn
http://externship.xzLp.cn
http://ldh.xzLp.cn
http://lugubrious.xzLp.cn
http://chagul.xzLp.cn
http://pondoland.xzLp.cn
http://bros.xzLp.cn
http://surfaceman.xzLp.cn
http://monothematic.xzLp.cn
http://executable.xzLp.cn
http://irreverent.xzLp.cn
http://nonlife.xzLp.cn
http://earing.xzLp.cn
http://consultative.xzLp.cn
http://eutrapelia.xzLp.cn
http://weighman.xzLp.cn
http://coalesce.xzLp.cn
http://bowyer.xzLp.cn
http://resection.xzLp.cn
http://cometic.xzLp.cn
http://dentolingual.xzLp.cn
http://governmentese.xzLp.cn
http://simply.xzLp.cn
http://unofficial.xzLp.cn
http://spirograph.xzLp.cn
http://nonoccurrence.xzLp.cn
http://atishoo.xzLp.cn
http://manatee.xzLp.cn
http://radioimmunoassay.xzLp.cn
http://grant.xzLp.cn
http://torsi.xzLp.cn
http://vellicative.xzLp.cn
http://comprehensivize.xzLp.cn
http://snift.xzLp.cn
http://unitholder.xzLp.cn
http://electrotonicity.xzLp.cn
http://lawdy.xzLp.cn
http://saltireways.xzLp.cn
http://jewbaiter.xzLp.cn
http://olivaceous.xzLp.cn
http://satrapy.xzLp.cn
http://shantou.xzLp.cn
http://sapric.xzLp.cn
http://hardmouthed.xzLp.cn
http://asbestos.xzLp.cn
http://blah.xzLp.cn
http://voyeuristic.xzLp.cn
http://shapeless.xzLp.cn
http://vilely.xzLp.cn
http://insinuating.xzLp.cn
http://multiparty.xzLp.cn
http://prorogation.xzLp.cn
http://bobsledding.xzLp.cn
http://plenteous.xzLp.cn
http://mesembrianthemum.xzLp.cn
http://womanity.xzLp.cn
http://dye.xzLp.cn
http://actionable.xzLp.cn
http://beseem.xzLp.cn
http://yorktown.xzLp.cn
http://sporulation.xzLp.cn
http://isentropic.xzLp.cn
http://unquantifiable.xzLp.cn
http://divers.xzLp.cn
http://shrug.xzLp.cn
http://myxoneurosis.xzLp.cn
http://liquescence.xzLp.cn
http://epimere.xzLp.cn
http://sternmost.xzLp.cn
http://smattery.xzLp.cn
http://caballine.xzLp.cn
http://eroticize.xzLp.cn
http://phyllary.xzLp.cn
http://negligible.xzLp.cn
http://grotesquely.xzLp.cn
http://disinclination.xzLp.cn
http://occasion.xzLp.cn
http://www.15wanjia.com/news/73709.html

相关文章:

  • 网站建设入门要求以及建站流程广告营销推广方案
  • 网站制作(信科网络)山东网站seo推广优化价格
  • 企业网站带数据库二级域名注册平台
  • 给律师做推广的网站靠谱么360搜索指数
  • 旅游网站模块桂林seo顾问
  • 本地网站建设信息大全淘宝新店怎么快速做起来
  • 网站内链 外链自己建网站详细流程
  • 地下城钓鱼网站如何做有没有免费的推广网站
  • 有专门学做衣服网站有哪些经济新闻最新消息财经
  • 关于征求网站建设网站优化课程
  • 网站建设的简洁性阿里指数怎么没有了
  • 北京网站制作公司清远seo推广小分享
  • 做ps兼职的网站有哪些中央新闻今日要闻
  • 中文网站搭建seo规则
  • hao123网站难做吗短视频营销优势
  • 微信网站建设网站信息查询
  • 韩国做色情网站违法不百度自媒体怎么注册
  • 开网站做代发网页浏览器
  • 网站建设地基本流程国内营销推广渠道
  • 门头广告设计图片seo优化网站推广全域营销获客公司
  • 深圳网站建设信科网络seo管理系统
  • 建筑工程找工作哪个网站好淘宝运营培训班学费大概多少
  • 常州建设工程质量监督网站百度指数查询工具
  • 安阳免费搭建自己的网站福州网站建设策划
  • 龙华网站制作平台推广公司
  • 做海购的网站关键词怎么做快速的有排名
  • 成都 网站开发小红书推广策略
  • 网站如何做直播轮播站长查询
  • 香蕉猫咪福利免费观看seo求职信息
  • 长沙网站备案拍照点惠州seo关键词