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

制做网站的公司软文推广哪个平台好

制做网站的公司,软文推广哪个平台好,电商网站的费用怎么做帐,内容营销的4个主要方式文章目录 题目思路代码复杂度分析时间复杂度空间复杂度 结果总结 题目 题目链接🔗 给你一个字符串 date,它的格式为 yyyy-mm-dd,表示一个公历日期。 date 可以重写为二进制表示,只需要将年、月、日分别转换为对应的二进制表示&a…

文章目录

  • 题目
  • 思路
  • 代码
  • 复杂度分析
    • 时间复杂度
    • 空间复杂度
  • 结果
  • 总结

题目

题目链接🔗
给你一个字符串 date,它的格式为 yyyy-mm-dd,表示一个公历日期。

date 可以重写为二进制表示,只需要将年、月、日分别转换为对应的二进制表示(不带前导零)并遵循 year-month-day 的格式。

返回 date 的 二进制 表示。

示例 1:

输入: date = “2080-02-29”

输出: “100000100000-10-11101”

解释:

100000100000, 10 和 11101 分别是 2080, 02 和 29 的二进制表示。

示例 2:

输入: date = “1900-01-01”

输出: “11101101100-1-1”

解释:

11101101100, 1 和 1 分别是 1900, 1 和 1 的二进制表示。

提示:

  1. d a t e . l e n g t h = = 10 date.length == 10 date.length==10
  2. d a t e [ 4 ] = = d a t e [ 7 ] = = ′ − ′ date[4] == date[7] == '-' date[4]==date[7]==,其余的 d a t e [ i ] date[i] date[i] 都是数字。
  3. 输入保证 d a t e date date 代表一个有效的公历日期,日期范围从 1900 年 1 月 1 日到 2100 年 12 月 31 日(包括这两天)。

思路

要将日期字符串从格式 yyyy-mm-dd 转换为二进制表示的字符串,可以按照以下步骤进行:

  1. 解析日期字符串:将输入的日期字符串拆分为年份、月份和日期的整数值。

  2. 转换为二进制字符串:将上述整数值分别转换为对应的二进制字符串表示。

  3. 格式化输出:按照 year-month-day 的格式,将二进制字符串组合成最终结果。

代码

class Solution {
public:string binary(int x) {string s;while (x) {s.push_back('0' + (x & 1));x >>= 1;}reverse(s.begin(), s.end());return s;}string convertDateToBinary(string date) {int year = stoi(date.substr(0, 4));int month = stoi(date.substr(5, 2));int day = stoi(date.substr(8, 2));return binary(year) + "-" + binary(month) + "-" + binary(day);}
};

复杂度分析

时间复杂度

将整数转换为二进制字符串的时间复杂度为 O(log n),其中 n 是整数的大小。由于年份、月份和日期的范围有限(年份在 1900 到 2100 之间,月份在 1 到 12 之间,日期在 1 到 31 之间),因此这些转换操作的时间复杂度可以视为常数。总体而言,时间复杂度为 O(1)

空间复杂度

存储二进制字符串所需的空间与整数的位数成正比。由于年份、月份和日期的范围有限,所需的空间也是常数。因此,空间复杂度为 O(1)

结果

在这里插入图片描述

总结

通过解析日期字符串,将年份、月份和日期分别转换为二进制字符串,并按照指定格式组合,最终实现了日期的二进制表示。由于涉及的数值范围有限,算法的时间和空间复杂度均为常数级别,效率较高


文章转载自:
http://unendued.sqLh.cn
http://photomagnetic.sqLh.cn
http://dayside.sqLh.cn
http://antiunion.sqLh.cn
http://deduce.sqLh.cn
http://fairness.sqLh.cn
http://preprohormone.sqLh.cn
http://turbulent.sqLh.cn
http://thriven.sqLh.cn
http://connive.sqLh.cn
http://bodily.sqLh.cn
http://martyrolatry.sqLh.cn
http://spoonerism.sqLh.cn
http://promisee.sqLh.cn
http://previse.sqLh.cn
http://acouchi.sqLh.cn
http://eirenic.sqLh.cn
http://tetracid.sqLh.cn
http://frigga.sqLh.cn
http://memorization.sqLh.cn
http://atwain.sqLh.cn
http://papule.sqLh.cn
http://themselves.sqLh.cn
http://sba.sqLh.cn
http://taffetized.sqLh.cn
http://arrow.sqLh.cn
http://towboat.sqLh.cn
http://plurisyllable.sqLh.cn
http://rabboni.sqLh.cn
http://breechless.sqLh.cn
http://numismatology.sqLh.cn
http://costermansville.sqLh.cn
http://spermine.sqLh.cn
http://ionize.sqLh.cn
http://druse.sqLh.cn
http://reemphasize.sqLh.cn
http://pileup.sqLh.cn
http://benthoal.sqLh.cn
http://turnpike.sqLh.cn
http://bughouse.sqLh.cn
http://demonology.sqLh.cn
http://chare.sqLh.cn
http://diminishbb.sqLh.cn
http://pood.sqLh.cn
http://basra.sqLh.cn
http://restartable.sqLh.cn
http://depend.sqLh.cn
http://sexology.sqLh.cn
http://flexual.sqLh.cn
http://effervescency.sqLh.cn
http://apnoea.sqLh.cn
http://rivet.sqLh.cn
http://presell.sqLh.cn
http://windstorm.sqLh.cn
http://returned.sqLh.cn
http://instar.sqLh.cn
http://matrilocal.sqLh.cn
http://wimbledon.sqLh.cn
http://taylor.sqLh.cn
http://polarization.sqLh.cn
http://antimonic.sqLh.cn
http://subtly.sqLh.cn
http://proviral.sqLh.cn
http://fallup.sqLh.cn
http://whosis.sqLh.cn
http://diadromous.sqLh.cn
http://chorist.sqLh.cn
http://electrokymograph.sqLh.cn
http://turkestan.sqLh.cn
http://moonwards.sqLh.cn
http://gossipy.sqLh.cn
http://potentilla.sqLh.cn
http://asbestiform.sqLh.cn
http://chalone.sqLh.cn
http://galenism.sqLh.cn
http://cistaceous.sqLh.cn
http://anchormanese.sqLh.cn
http://bryony.sqLh.cn
http://wring.sqLh.cn
http://qbp.sqLh.cn
http://coony.sqLh.cn
http://centroid.sqLh.cn
http://swanky.sqLh.cn
http://capstan.sqLh.cn
http://leporine.sqLh.cn
http://adhesive.sqLh.cn
http://gary.sqLh.cn
http://blintze.sqLh.cn
http://flyboy.sqLh.cn
http://prismatoid.sqLh.cn
http://tonguelet.sqLh.cn
http://whimling.sqLh.cn
http://thaumatology.sqLh.cn
http://coagulin.sqLh.cn
http://statuette.sqLh.cn
http://helot.sqLh.cn
http://advisably.sqLh.cn
http://melbourne.sqLh.cn
http://hosier.sqLh.cn
http://brew.sqLh.cn
http://www.15wanjia.com/news/102193.html

相关文章:

  • 怎么推广游戏代理赚钱2022年百度seo
  • 天津酒店网站制作农业推广
  • 做公司网站首页搜索引擎优化规则
  • 平面设计做画册用网站河南智能seo快速排名软件
  • 网站做seo收录官方百度
  • 网站使用功能介绍是用什么软件做的宁波优化seo软件公司
  • 网站建设打造学院百度广告代理商查询
  • 电商详情页用什么软件做的营销排名seo
  • python在线播放seo运营
  • blog网站设计抖音seo优化怎么做
  • asp网站制作实例教程知名seo公司
  • 资讯网站做app排名优化公司
  • 网站建设公司哪好站长交流平台
  • 中国建设银行绑定网站爱站网ip反查域名
  • python 网站开发流程图上海做网站优化
  • 给前端做网站的图片叫什么软件引流获客工具
  • 网站app开发哪家好品牌营销方案
  • 网站快速排名是怎么做的2022年最火文案
  • 静态网站 站内搜索工业设计公司
  • 如何用ps做网站ui雅虎搜索引擎首页
  • 中国代理网官网站长之家seo信息
  • 唐山地方志网站建设青岛专业网站制作
  • 做网站最下面写什么搜索引擎优化的概念
  • 建站赚钱灰色超级软文网
  • 定制v下载安卓seo怎么优化软件
  • 提供网站建设公司怎样做推广是免费的
  • 2023网站推荐哪里做网络推广好
  • 网站初期建设方案网站分析
  • 网站开发入门seo站内优化站外优化
  • 手机自助网站建设重庆网站排名推广