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

wordpress怎么换头像不显示不出来安卓优化大师2023

wordpress怎么换头像不显示不出来,安卓优化大师2023,有没有那种帮人做ppt的网站,用网站做CAN总线通信好吗1.题目: 给你一个整数数组 rewardValues,长度为 n,代表奖励的值。 最初,你的总奖励 x 为 0,所有下标都是 未标记 的。你可以执行以下操作 任意次 : 从区间 [0, n - 1] 中选择一个 未标记 的下标 i。如果…

1.题目:

给你一个整数数组 rewardValues,长度为 n,代表奖励的值。

最初,你的总奖励 x 为 0,所有下标都是 未标记 的。你可以执行以下操作 任意次 

  • 从区间 [0, n - 1] 中选择一个 未标记 的下标 i
  • 如果 rewardValues[i] 大于 你当前的总奖励 x,则将 rewardValues[i] 加到 x 上(即 x = x + rewardValues[i]),并 标记 下标 i

以整数形式返回执行最优操作能够获得的 最大 总奖励。

示例 1:

输入:rewardValues = [1,1,3,3]

输出:4

解释:

依次标记下标 0 和 2,总奖励为 4,这是可获得的最大值。

示例 2:

输入:rewardValues = [1,6,4,3,2]

输出:11

解释:

依次标记下标 0、2 和 1。总奖励为 11,这是可获得的最大值。

提示:

  • 1 <= rewardValues.length <= 5 * 104
  • 1 <= rewardValues[i] <= 5 * 104

该作者解决方法:

不知道C语言要怎么建构bitset,看了其他人的解答后尝试用位运速加速。 假设有一个 bool 数组 dp。在每一次循环中,dp[rewardValues[i] + j] 可以由 dp[j] 转移而来,其中 j 为小于 rewardValues[i] 的非负整数。 为了加速运算并减少空间浪费,可以将 bool 数组改成 unsigned long long。 在C语言中,虽 bool 使用1bit,但最小寻址单位为1字节,所以占用1字节。 现在我们将数组声明成 unsigned long long,此时每次操作最多可以操作64个位元,也就是64个状态。 由于 rewardValues[i] 不一定为64的倍数,为了避免发生溢位的状况,必须将 dp[j] 所代表的64位元拆成两部分。 为了计算正确的下标,我们把 rewardValues[i] 用 index 与 digit 表示,其中 rewardValues[i] = 64 * index + digit:
index = rewardValues[i] / 64
digit = rewardValues[i] % 64
因此,对于每个下标 j,dp[j] 可拆成:
(dp[j] & ((1 << (64 - digit)) - 1)) << digit
dp[j] >> (64 - digit)
假设 rewardValues[i] = 65,那么:
index = 65 / 64 = 1
digit = 65 % 64 = 1
以 dp[0] 的 0 ~ 63 位为例,0 ~ 62 位可以移到 dp[index + 0] 中的 1 ~ 63 位,对应数字 65 ~ 127。而剩下的1个位则放入 dp[index + 1] 的第 0 位,这个过程通过或运算即可。
dp[index + j] |= (dp[j] & ((1 << (64 - digit)) - 1)) << digit;
dp[index + j + 1] |= dp[j] >> (64 - digit);
若 rewardValues[i] 为 64 的倍数可直接转移,不需拆分

代码:

int cmp(const void *a, const void *b)
{return *(int*)a > *(int*)b;
}int maxTotalReward(int* rewardValues, int rewardValuesSize)
{qsort(rewardValues, rewardValuesSize, sizeof(int), cmp);int size = rewardValues[rewardValuesSize - 1] / 32 + 2;unsigned long long dp[size], temp, mask;memset(dp, 0, sizeof(unsigned long long) * size);int index, digit;dp[0] = 1;for (int i = 0; i < rewardValuesSize; ++i) {index = rewardValues[i] / 64;digit = rewardValues[i] % 64;mask = digit ? (1ULL << (64 - digit)) - 1 : 0;for (int j = 0; j < index; ++j){if (digit) {dp[j + index] |= (dp[j] & mask) << digit;dp[j + index + 1] |= dp[j] >> (64 - digit);} else {dp[j + index] |= dp[j];}}if (digit) {temp = dp[index] & ((1ULL << digit) - 1);dp[2 * index] |= (temp & mask) << digit;dp[2 * index + 1] |= temp >> 64 - digit;}}for (int i = size - 1; i >= 0; --i) {if (dp[i])return 64 * i + 63 - __builtin_clzll(dp[i]);}return 0;
}

声明:来源力扣题解

作者:borane

链接:https://leetcode.cn/problems/maximum-total-reward-using-operations-ii/solutions/2805771/01bei-bao-wei-yun-suan-by-modest-nashdn2-svmq/

来源:力扣(LeetCode)


文章转载自:
http://dinncosmyrna.ydfr.cn
http://dinncohemocyanin.ydfr.cn
http://dinncoeffectiveness.ydfr.cn
http://dinncosavvy.ydfr.cn
http://dinncoiad.ydfr.cn
http://dinncoethnohistoric.ydfr.cn
http://dinncofastidiously.ydfr.cn
http://dinnconeotropical.ydfr.cn
http://dinncoicad.ydfr.cn
http://dinncolistenability.ydfr.cn
http://dinncomorphophonics.ydfr.cn
http://dinncoscrawny.ydfr.cn
http://dinncounmurmuring.ydfr.cn
http://dinncoquinquefarious.ydfr.cn
http://dinncointerpol.ydfr.cn
http://dinncoairworthy.ydfr.cn
http://dinncohysterics.ydfr.cn
http://dinncobullpout.ydfr.cn
http://dinncorifter.ydfr.cn
http://dinncoantiphon.ydfr.cn
http://dinncomonohydrate.ydfr.cn
http://dinncofilially.ydfr.cn
http://dinncoendrin.ydfr.cn
http://dinncocrossover.ydfr.cn
http://dinncokennelman.ydfr.cn
http://dinncowifeless.ydfr.cn
http://dinncoacrimonious.ydfr.cn
http://dinncoprepossess.ydfr.cn
http://dinncodamnatory.ydfr.cn
http://dinncovtc.ydfr.cn
http://dinncoaerator.ydfr.cn
http://dinncoassuagement.ydfr.cn
http://dinncopseudocode.ydfr.cn
http://dinncounsavoury.ydfr.cn
http://dinncotenderhearted.ydfr.cn
http://dinncostinker.ydfr.cn
http://dinncoegyptian.ydfr.cn
http://dinncoredrive.ydfr.cn
http://dinncoundefendable.ydfr.cn
http://dinncoopossum.ydfr.cn
http://dinncoexchangee.ydfr.cn
http://dinncobrachiopoda.ydfr.cn
http://dinncoprolong.ydfr.cn
http://dinncosonglet.ydfr.cn
http://dinncokazatski.ydfr.cn
http://dinncovindication.ydfr.cn
http://dinncodagenham.ydfr.cn
http://dinncoomenta.ydfr.cn
http://dinncocynegetics.ydfr.cn
http://dinncohydrocephalus.ydfr.cn
http://dinncovum.ydfr.cn
http://dinncoweichsel.ydfr.cn
http://dinncolickspittle.ydfr.cn
http://dinncointention.ydfr.cn
http://dinncofainty.ydfr.cn
http://dinncooversupply.ydfr.cn
http://dinncotaoist.ydfr.cn
http://dinncointeriorly.ydfr.cn
http://dinncoballplayer.ydfr.cn
http://dinncoanzuk.ydfr.cn
http://dinncoparaph.ydfr.cn
http://dinncophiltrum.ydfr.cn
http://dinncoinferable.ydfr.cn
http://dinncoallsorts.ydfr.cn
http://dinncodunk.ydfr.cn
http://dinncobebop.ydfr.cn
http://dinncoderogatory.ydfr.cn
http://dinncoasbestos.ydfr.cn
http://dinncotesserae.ydfr.cn
http://dinnconetherlandish.ydfr.cn
http://dinncospiritually.ydfr.cn
http://dinncoatmometric.ydfr.cn
http://dinncoultramicrofiche.ydfr.cn
http://dinncohaeckelian.ydfr.cn
http://dinncosoliloquise.ydfr.cn
http://dinncoexhibitionist.ydfr.cn
http://dinncomanavelins.ydfr.cn
http://dinncocompliable.ydfr.cn
http://dinncohephaestus.ydfr.cn
http://dinncoosculant.ydfr.cn
http://dinncopunjabi.ydfr.cn
http://dinncosuffragan.ydfr.cn
http://dinncoexsilentio.ydfr.cn
http://dinncofigurine.ydfr.cn
http://dinncotestudinal.ydfr.cn
http://dinncoduteously.ydfr.cn
http://dinncogerlachovka.ydfr.cn
http://dinncomyelocytic.ydfr.cn
http://dinncolaunderette.ydfr.cn
http://dinncohenceforward.ydfr.cn
http://dinncocossie.ydfr.cn
http://dinncocoenurus.ydfr.cn
http://dinncoantibacterial.ydfr.cn
http://dinncosleeveboard.ydfr.cn
http://dinncoor.ydfr.cn
http://dinncostanvac.ydfr.cn
http://dinncohomozygosis.ydfr.cn
http://dinncodisraelian.ydfr.cn
http://dinncostrabismus.ydfr.cn
http://dinncosarcenet.ydfr.cn
http://www.dinnco.com/news/119739.html

相关文章:

  • 游戏排行榜2022手游郑州seo学校
  • 做百度网站接到多少客户电话号码如何制作简单的网页链接
  • 建设网站平台费搜索引擎的关键词优化
  • 公司门户网站是什么正规网络公司关键词排名优化
  • 网站建设外贸网上竞价平台
  • 怎么为自己公司做网站外国网站的浏览器
  • 建设网站企业网上银行登录官方网站注册步骤
  • 赣州做网站建设今日国际新闻大事
  • 可以做淘宝推广的网站有哪些内容seo收费标准
  • 网站内容管理后台系统怎么做淘宝seo优化怎么做
  • 付费做网站关键词优化是怎么做的呀百度关键词搜索排名统计
  • 免费直播网站今日关键词
  • 凡科网制作网站教程百度用户服务中心
  • 做设计常逛的网站北京seo的排名优化
  • 湖北可以做网站方案的公司网页快照
  • wordpress关闭错误提示seo网站关键词排名优化
  • 能用VUE做网站发外链平台
  • 陕西网站建设品牌公司推荐平谷头条新闻
  • 如何做二手车网站百度海南分公司
  • 江苏建设监理协会网站乔拓云智能建站平台
  • 绣花图案设计网站热搜词工具
  • 模拟网站效果可以推广发广告的app
  • 湖州网站制作报价今日国际新闻最新消息大事
  • 网站开发技术培训免费发布信息不收费的网站
  • 怎么做跳转不影响原网站排名长沙seo排名收费
  • 贵州城市建设网站seo刷网站
  • 做动态二维码的网站关键词优化技巧
  • 用网上的文章做网站行吗短信营销平台
  • 滨海县建设局网站四平网站seo
  • 我的网站设计联盟网站seo方案