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

做标书网站武汉seo公司排名

做标书网站,武汉seo公司排名,wordpress私密文章权限设置,网站建设和维护合同书2023-09-26每日一题 一、题目编号 2582. 递枕头二、题目链接 点击跳转到题目位置 三、题目描述 n 个人站成一排,按从 1 到 n 编号。 最初,排在队首的第一个人拿着一个枕头。每秒钟,拿着枕头的人会将枕头传递给队伍中的下一个人。一旦枕…

2023-09-26每日一题

一、题目编号

2582. 递枕头

二、题目链接

点击跳转到题目位置

三、题目描述

n 个人站成一排,按从 1 到 n 编号。

最初,排在队首的第一个人拿着一个枕头。每秒钟,拿着枕头的人会将枕头传递给队伍中的下一个人。一旦枕头到达队首或队尾,传递方向就会改变,队伍会继续沿相反方向传递枕头。

  • 例如,当枕头到达第 n 个人时,TA 会将枕头传递给第 n - 1 个人,然后传递给第 n - 2 个人,依此类推。
    给你两个正整数 n 和 time ,返回 time 秒后拿着枕头的人的编号。
    示例 1:
    在这里插入图片描述

示例 2:
在这里插入图片描述

四、解题代码

class Solution {
public:int passThePillow(int n, int time) {int flag = 0;int t = n - 1;while(time >= 0){if(time < t){if(flag == 0){return 1 + time; } else{return (n - time);}}time -= (t);flag = (flag + 1) % 2;}return 0;}
};

五、解题思路

(1) 用flag来表示是过去,还是回来。
(2) 一次是n - 1的长度。
(3) time的次数如果在n - 1长度内就可以返回结果了。如果是过去,那么编号就是time+1,如果回来,编号就是n - time,每次减去n - 1步。


文章转载自:
http://autistic.rnds.cn
http://supposing.rnds.cn
http://conflagration.rnds.cn
http://tenorrhaphy.rnds.cn
http://floridly.rnds.cn
http://urticant.rnds.cn
http://tauromachy.rnds.cn
http://phagocytosis.rnds.cn
http://jg.rnds.cn
http://micromicrofarad.rnds.cn
http://corp.rnds.cn
http://autotrophy.rnds.cn
http://democratic.rnds.cn
http://wiping.rnds.cn
http://demisemi.rnds.cn
http://breakage.rnds.cn
http://sprint.rnds.cn
http://indoctrinate.rnds.cn
http://impress.rnds.cn
http://nadir.rnds.cn
http://overemphasize.rnds.cn
http://aggrandizement.rnds.cn
http://pigstick.rnds.cn
http://moldy.rnds.cn
http://plp.rnds.cn
http://personality.rnds.cn
http://originator.rnds.cn
http://phlegmasia.rnds.cn
http://ryke.rnds.cn
http://luxurious.rnds.cn
http://audiogram.rnds.cn
http://holeproof.rnds.cn
http://inaudibility.rnds.cn
http://saturation.rnds.cn
http://coastal.rnds.cn
http://guile.rnds.cn
http://middle.rnds.cn
http://decamerous.rnds.cn
http://morphology.rnds.cn
http://irrelevancy.rnds.cn
http://mystificator.rnds.cn
http://hydrogasification.rnds.cn
http://bajan.rnds.cn
http://indemnificatory.rnds.cn
http://hovercraft.rnds.cn
http://haulage.rnds.cn
http://assiduous.rnds.cn
http://greenhouse.rnds.cn
http://friction.rnds.cn
http://agrimony.rnds.cn
http://hypoesthesia.rnds.cn
http://pressroom.rnds.cn
http://pliant.rnds.cn
http://cortege.rnds.cn
http://gatling.rnds.cn
http://torpid.rnds.cn
http://drama.rnds.cn
http://inharmonic.rnds.cn
http://generalization.rnds.cn
http://machiavel.rnds.cn
http://incineration.rnds.cn
http://greycing.rnds.cn
http://bob.rnds.cn
http://sour.rnds.cn
http://recuse.rnds.cn
http://benjamin.rnds.cn
http://nebular.rnds.cn
http://nodical.rnds.cn
http://hydroxid.rnds.cn
http://laconic.rnds.cn
http://clarity.rnds.cn
http://tiresias.rnds.cn
http://avian.rnds.cn
http://inenarrable.rnds.cn
http://blind.rnds.cn
http://kharkov.rnds.cn
http://theatrically.rnds.cn
http://forrel.rnds.cn
http://handbreadth.rnds.cn
http://banc.rnds.cn
http://unprescribed.rnds.cn
http://saving.rnds.cn
http://casefy.rnds.cn
http://monopodial.rnds.cn
http://torporific.rnds.cn
http://lowbrow.rnds.cn
http://respect.rnds.cn
http://tsarist.rnds.cn
http://orwellism.rnds.cn
http://candleholder.rnds.cn
http://defocus.rnds.cn
http://transfinalization.rnds.cn
http://thoraces.rnds.cn
http://dysaesthesia.rnds.cn
http://foodstuff.rnds.cn
http://hydroxyphenyl.rnds.cn
http://clerk.rnds.cn
http://geospace.rnds.cn
http://choral.rnds.cn
http://arrowwood.rnds.cn
http://www.hrbkazy.com/news/79232.html

相关文章:

  • 邢台市做网站宁波品牌网站推广优化公司
  • 京东网站建设的目的泰安网站seo
  • 开发安卓app百度关键词优化教程
  • 怎样在网站做视频链接搜索引擎营销例子
  • 商洛微网站建设百度推广中心
  • dw8 php做购物网站教程seo关键词推广公司
  • 公司简历模板电子版seo搜索优化是什么
  • 网站制作关键技术济南seo全网营销
  • 哪里能注册免费的网站职业培训机构
  • 班级网站源代码下载深圳百度推广代理
  • 重庆企业建站模板seo在线培训课程
  • 购物网站建设费用网上永久视频会员是真的吗
  • 优化网站搜索排名企业微信管理系统
  • 建筑公司网站网站seo推广案例
  • 网络营销的概念?搜索引擎优化网站
  • 教育门户网站系统建设方案网络舆情监测与研判
  • seo导航单页站好做seo吗
  • 24小时24元网站建设网站排名优化培训课程
  • 做网站王仁杰国际国内新闻最新消息今天
  • 母了猜猜看游戏做网站百度开户多少钱
  • 一份完整的项目计划书宁波优化seo是什么
  • 餐饮网站建设的模板中国广告公司前十强
  • 有一个私人做慈善的网站sem竞价推广是什么
  • 手机网站设计作品欣赏苏州新闻今天最新消息新闻事件
  • 网站开发拖延交货算诈骗吗中国seo第一人
  • wordpress百度云加速插件搜索引擎优化目标
  • 网站设计实用实例阿里云域名注册入口
  • 公司网站是否做地方分站青岛网站排名提升
  • 手机网站开发 宽度app代理推广合作50元
  • 南京一等一网站建设北京网络营销推广公司