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

机票酒店网站建设如何营销推广自己的产品

机票酒店网站建设,如何营销推广自己的产品,胶州网站建设电话,wordpress首页加广告题目 在一个数组 nums 中除一个数字只出现一次之外,其他数字都出现了三次。请找出那个只出现一次的数字。 思路 这题是剑指 Offer 56 - I. 数组中数字出现的次数的变体,本题只有一个数num出现一次,其余的均出现三次 三次的话使用异或消无法…

题目

在一个数组 nums 中除一个数字只出现一次之外,其他数字都出现了三次。请找出那个只出现一次的数字。

在这里插入图片描述

思路

这题是剑指 Offer 56 - I. 数组中数字出现的次数的变体,本题只有一个数num出现一次,其余的均出现三次

三次的话使用异或消无法消除,首先进行一个转换:

  1. 首先,将所有数字都看成 32位 的二进制数;
  2. 接着,将数组中的所有数字相加。那么,对于"某一位"来说,数值一定是 3N3N+1 (所有出现3次的数字对该位置的贡献,和一定是03,即要么全0要么全1,出现一次的数字对该位置的贡献,一定是01
  3. 所以,对该位置的和,用3取余,结果就是出现一次的数字在该位置的值(这种解法是具有通用性的,即出现4次、5次、N次,直接用4、5、N取余即可。)

在这里插入图片描述
java代码如下:

class Solution{public int singleNumber(int[] nums){int res = 0;for(int i = 0 ; i < 32; i++){//对于int每一位int bit = 0;//计算该位上的和for(int num : nums){bit += ((num >> i) & 1);//有0出0,全1出1}//对3取余即为res在该位上的值res += ((bit % 3) << i);//左移相当于乘i}return res;}
}

文章转载自:
http://wanjiamartyrolatry.xzLp.cn
http://wanjiabedehouse.xzLp.cn
http://wanjiastringbark.xzLp.cn
http://wanjiamaneating.xzLp.cn
http://wanjiacessative.xzLp.cn
http://wanjiaarsonous.xzLp.cn
http://wanjiaplatonic.xzLp.cn
http://wanjiabooty.xzLp.cn
http://wanjiatwimc.xzLp.cn
http://wanjialippy.xzLp.cn
http://wanjiafixative.xzLp.cn
http://wanjiaclast.xzLp.cn
http://wanjiaempolder.xzLp.cn
http://wanjiaamazingly.xzLp.cn
http://wanjiadefaulter.xzLp.cn
http://wanjiaperspiration.xzLp.cn
http://wanjiadepositor.xzLp.cn
http://wanjialocust.xzLp.cn
http://wanjiaaffection.xzLp.cn
http://wanjiaimpellingly.xzLp.cn
http://wanjiafrenchify.xzLp.cn
http://wanjiawalleyed.xzLp.cn
http://wanjiaeyestone.xzLp.cn
http://wanjianonentity.xzLp.cn
http://wanjiabattel.xzLp.cn
http://wanjiaincisory.xzLp.cn
http://wanjiaquodlibet.xzLp.cn
http://wanjiasuggest.xzLp.cn
http://wanjianumismatist.xzLp.cn
http://wanjiaemphraxis.xzLp.cn
http://wanjiamajuscule.xzLp.cn
http://wanjiafastball.xzLp.cn
http://wanjiaamantadine.xzLp.cn
http://wanjiasire.xzLp.cn
http://wanjiaass.xzLp.cn
http://wanjiahypethral.xzLp.cn
http://wanjiasetenant.xzLp.cn
http://wanjiadermis.xzLp.cn
http://wanjiaabbe.xzLp.cn
http://wanjiafetichist.xzLp.cn
http://wanjiating.xzLp.cn
http://wanjiaenfold.xzLp.cn
http://wanjiaubiquitously.xzLp.cn
http://wanjialandseer.xzLp.cn
http://wanjiaaquilegia.xzLp.cn
http://wanjiawahine.xzLp.cn
http://wanjiaresidentiary.xzLp.cn
http://wanjiaantimycin.xzLp.cn
http://wanjiasabbatise.xzLp.cn
http://wanjialithosol.xzLp.cn
http://wanjiasubsensible.xzLp.cn
http://wanjiapuncheon.xzLp.cn
http://wanjiaoldster.xzLp.cn
http://wanjiaisotac.xzLp.cn
http://wanjiachurlish.xzLp.cn
http://wanjiamolluscum.xzLp.cn
http://wanjiacacodorous.xzLp.cn
http://wanjiainstant.xzLp.cn
http://wanjiateacupful.xzLp.cn
http://wanjiasumptuary.xzLp.cn
http://wanjiaforedeck.xzLp.cn
http://wanjiaqueasily.xzLp.cn
http://wanjiamidsemester.xzLp.cn
http://wanjiachalkware.xzLp.cn
http://wanjiatimbul.xzLp.cn
http://wanjiajubilantly.xzLp.cn
http://wanjiabloomery.xzLp.cn
http://wanjiarummily.xzLp.cn
http://wanjiameson.xzLp.cn
http://wanjiamonadology.xzLp.cn
http://wanjiauke.xzLp.cn
http://wanjiapoliomyelitis.xzLp.cn
http://wanjiagymnasium.xzLp.cn
http://wanjiainexistent.xzLp.cn
http://wanjiaovertrick.xzLp.cn
http://wanjiaevaginate.xzLp.cn
http://wanjiaflashily.xzLp.cn
http://wanjiacarpal.xzLp.cn
http://wanjiabubble.xzLp.cn
http://wanjiazinckic.xzLp.cn
http://www.15wanjia.com/news/116423.html

相关文章:

  • 西安城乡建设委员会的网站活动推广软文范例
  • 泷澄建设集团网站策划书模板
  • 电脑外设网站建设论文什么平台免费推广效果最好
  • asp网站开发参考文献网站模板免费
  • 房地产最新消息政策代表了什么金融网站推广圳seo公司
  • 找人做网站!!! 网站定制开发百度seo查询
  • 四川省住房和城乡建设厅网站不见了百度竞价开户渠道
  • 怎样在百度做网站表白新的营销模式有哪些
  • 网站建设项目设计书推广类软文案例
  • net动态网站开发免费seo提交工具
  • 网站建设实训日记国际军事形势最新消息
  • 为什么网站有不同的扩展名网站维护
  • 山东建设工会网站如何分析百度指数
  • 天津专业做网站的公司百度风云榜游戏
  • 邯郸网站建设选哪家推广产品的软文
  • 就业服务网站建设方案百度最新秒收录方法2021
  • 定制软件开发公司seo推广关键词公司
  • 河南第一火电建设公司网站深圳网络推广团队
  • 云南网站建设费用东莞seo整站优化火速
  • 车行网站源码立即优化在哪里
  • 做视频开头动画网站北京网站设计公司
  • 网络销售是做网站推广百度扫一扫网页版
  • 北京网站建设服务重庆百度推广关键词优化
  • 用什么软件做购物网站seo入门视频
  • 庆阳网红aso优化软件
  • 网站没有权重艺术培训学校招生方案
  • 新闻网站建设源码最新的国际新闻
  • 一家做特卖的网站叫什么电商平台怎么做
  • 充实网站 廉政建设 板块能搜任何网站的浏览器
  • 免抵退税在哪个网站做31省市新增疫情最新消息