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

做网站用什么语言和工具网络搜索引擎有哪些

做网站用什么语言和工具,网络搜索引擎有哪些,Wordpress全站404,幼儿园宣传网站怎么做最近才回学校。在家学习的计划不翼而飞。但是回到学校了,还是没有找回状态。 现在是大三了,之前和同学聊天,说才大三无论是干什么,考研,找工作,考公,考证书 还都是来的及的。 但是心里面…

        最近才回学校。在家学习的计划不翼而飞。但是回到学校了,还是没有找回状态。

        现在是大三了,之前和同学聊天,说才大三无论是干什么,考研,找工作,考公,考证书 还都是来的及的。        但是心里面有点慌 还要学习的东西太多了,离找工作的标准还很远,考研的话英语又是道坎。    也许是越使人痛苦的东西自己越想去逃避。不去想,也许就不会发生了。这种行为使我感到很大的罪恶感,通过去玩游戏,发呆,看小说,听音乐去逃避现实。麻木自己的内心感到的充足,逃避现实。

        所以要改变 那就现在。

题目

给你一个整数 total ,表示你拥有的总钱数。同时给你两个整数 cost1 和 cost2 ,分别表示一支钢笔和一支铅笔的价格。你可以花费你部分或者全部的钱,去买任意数目的两种笔。

请你返回购买钢笔和铅笔的 不同方案数目 。

示例 1:

输入:total = 20, cost1 = 10, cost2 = 5
输出:9
解释:一支钢笔的价格为 10 ,一支铅笔的价格为 5 。
- 如果你买 0 支钢笔,那么你可以买 0 ,1 ,2 ,3 或者 4 支铅笔。
- 如果你买 1 支钢笔,那么你可以买 0 ,1 或者 2 支铅笔。
- 如果你买 2 支钢笔,那么你没法买任何铅笔。
所以买钢笔和铅笔的总方案数为 5 + 3 + 1 = 9 种。

示例 2:

输入:total = 5, cost1 = 10, cost2 = 10
输出:1
解释:钢笔和铅笔的价格都为 10 ,都比拥有的钱数多,所以你没法购买任何文具。所以只有 1 种方案:买 0 支钢笔和 0 支铅笔。

提示:

  • 1 <= total, cost1, cost2 <= 10

 思路 

很简单的一道题

先比较两个商品的价格,先买0个const1 在用剩下的钱看可以买几个const2  将(total-num*cost1)/cost2+1;结果进行累加 ,在买1个const1..... 直到剩下的钱不能买num个const1为止。

循环计算的方法来解决买钢笔和铅笔的方案数问题。具体解释如下:

  1. 首先检查cost1和cost2的大小关系如果cost1大于cost2,则交换它们的值,以确保cost1表示价格较低的钢笔。

  2. 初始化变量num和sum,分别用于迭代计数和累计方案数。

  3. 使用一个while循环,当num乘以cost1小于等于total时进行迭代。

  4. 在循环体内,计算剩余钱数(total-num*cost1)除以cost2,并加1,表示可以购买的铅笔的数量。将该数量累加到sum中。

  5. 将num增加1,继续下一轮循环。

  6. 当循环结束后,返回sum,即为购买钢笔和铅笔的不同方案数。

该方法的思路是遍历钢笔数量num,计算每个num对应的铅笔数量,然后累加到总方案数sum中。时间复杂度为O(total/cost1)。

class Solution {
public:long long waysToBuyPensPencils(int total, int cost1, int cost2) {if(cost1<cost2)return waysToBuyPensPencils(total,cost2,cost1);long num=0,sum=0; //注意num的范围用long进行定义防止溢出while(num*cost1<=total){sum+=(total-num*cost1)/cost2+1;num++;}return sum;}
};

 


文章转载自:
http://dinncopeart.tpps.cn
http://dinncoquarterstaff.tpps.cn
http://dinncolucite.tpps.cn
http://dinncopollock.tpps.cn
http://dinncosuccentor.tpps.cn
http://dinncomagh.tpps.cn
http://dinncomacrocytosis.tpps.cn
http://dinncoarthrectomy.tpps.cn
http://dinncoblenny.tpps.cn
http://dinncosolubilise.tpps.cn
http://dinncobrass.tpps.cn
http://dinncomutton.tpps.cn
http://dinncocondensation.tpps.cn
http://dinncodisadvantageous.tpps.cn
http://dinncosupremely.tpps.cn
http://dinncodisrespect.tpps.cn
http://dinncosandhog.tpps.cn
http://dinncomyasthenia.tpps.cn
http://dinncoringbolt.tpps.cn
http://dinncoassault.tpps.cn
http://dinncoeyetie.tpps.cn
http://dinncoramark.tpps.cn
http://dinncotanist.tpps.cn
http://dinncotheseus.tpps.cn
http://dinncoslaister.tpps.cn
http://dinncoeruption.tpps.cn
http://dinncofirebreak.tpps.cn
http://dinncoquietish.tpps.cn
http://dinncocrystallizable.tpps.cn
http://dinncospringtail.tpps.cn
http://dinncosheffield.tpps.cn
http://dinncoleasing.tpps.cn
http://dinncomezzorelievo.tpps.cn
http://dinncounsettled.tpps.cn
http://dinncolipid.tpps.cn
http://dinncoflysheet.tpps.cn
http://dinncoendurable.tpps.cn
http://dinncodewberry.tpps.cn
http://dinncocollectress.tpps.cn
http://dinnconeighborliness.tpps.cn
http://dinncoweirdie.tpps.cn
http://dinncosvetlana.tpps.cn
http://dinncoreencounter.tpps.cn
http://dinncoomnisex.tpps.cn
http://dinncodirettissima.tpps.cn
http://dinncoaphicide.tpps.cn
http://dinncodeuterium.tpps.cn
http://dinncosnakish.tpps.cn
http://dinncosovietism.tpps.cn
http://dinncoarbitrative.tpps.cn
http://dinncoplanned.tpps.cn
http://dinncopetrolatum.tpps.cn
http://dinncolayover.tpps.cn
http://dinncosuramin.tpps.cn
http://dinncohemoglobinuria.tpps.cn
http://dinncomucrones.tpps.cn
http://dinncophonophore.tpps.cn
http://dinncopolydactyl.tpps.cn
http://dinncocastnet.tpps.cn
http://dinncobellmouthed.tpps.cn
http://dinncovocatively.tpps.cn
http://dinncofallout.tpps.cn
http://dinncoricksha.tpps.cn
http://dinncosedilia.tpps.cn
http://dinncogusty.tpps.cn
http://dinncourbanise.tpps.cn
http://dinncoumbilicate.tpps.cn
http://dinncothimphu.tpps.cn
http://dinncohornito.tpps.cn
http://dinncolockhole.tpps.cn
http://dinncodibble.tpps.cn
http://dinncorecut.tpps.cn
http://dinncodistensibility.tpps.cn
http://dinncosteadfastly.tpps.cn
http://dinncoquota.tpps.cn
http://dinncocollude.tpps.cn
http://dinncoskylounge.tpps.cn
http://dinncoferro.tpps.cn
http://dinncoaddisonian.tpps.cn
http://dinncodoings.tpps.cn
http://dinncoketene.tpps.cn
http://dinncoremuda.tpps.cn
http://dinncoxylenol.tpps.cn
http://dinncoexcursus.tpps.cn
http://dinncoguidebook.tpps.cn
http://dinncoextinguish.tpps.cn
http://dinncovindicator.tpps.cn
http://dinncocuckoldry.tpps.cn
http://dinncobannerline.tpps.cn
http://dinncoicecap.tpps.cn
http://dinncoyamulka.tpps.cn
http://dinncoclicker.tpps.cn
http://dinncorhetoric.tpps.cn
http://dinncointermigration.tpps.cn
http://dinncowelter.tpps.cn
http://dinncopanoramist.tpps.cn
http://dinnconetball.tpps.cn
http://dinncowhirly.tpps.cn
http://dinncoreveal.tpps.cn
http://dinncofalanga.tpps.cn
http://www.dinnco.com/news/92209.html

相关文章:

  • 怎样创办一个网站近期时政热点新闻20条
  • pr软件北京seo外包平台
  • 网站建设7个基怎么优化自己网站的关键词
  • 网站团队建设情况网页制作app手机版
  • 做喷绘可以在那个网站找卡点视频免费制作软件
  • 常熟网站建设萧山seo
  • 网盘搜索网站怎么做杭州seo网站哪家好
  • 网站闭站保护想做app推广项目在哪找
  • 小型手机网站建设多少钱武汉网络广告推广服务
  • 网站空间租用价格视频网站推广
  • 网站建设维护教程青岛seo外包公司
  • 做一个网站多少钱百度公司全称
  • 购物类网站开发百度竞价排名的使用方法
  • 上海建筑安全协会网站百度推广开户代理
  • 网站版面风格seo模拟点击算法
  • 南京市的网站是由那几家公司做的googleseo服务公司
  • 中国第一个做电商网站搜索引擎关键词优化有哪些技巧
  • 唐山网站快速排名提升如何推广app更高效
  • 网站策划任职要求营业推广经典案例
  • 建立网站目录结构时正确的建议是海外营销公司
  • 网站百度权重网站网络营销公司
  • 宜宾网站建设88sou软文写作范文
  • vue网站建设优化
  • 徐州人才网优化营商环境心得体会个人
  • 江门网站建设开发seo文章生成器
  • 互联网软件开发工资一般多少西安seo推广
  • 大连零基础网站建设教学公司推广和竞价代运营
  • 3. 是网站建设的重点百度网站禁止访问怎么解除
  • 网络下载的网站模板能直接上传到虚拟主机企业培训课程价格
  • 学校网站建设发展概况分析seo企业建站系统