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

医院网站建设中标网站营销推广有哪些

医院网站建设中标,网站营销推广有哪些,做视频up主视频网站,济南网站建设培训班描述 将一个长度最多为30位数字的十进制非负整数转换为二进制数输出。 输入描述: 多组数据,每行为一个长度不超过30位的十进制非负整数。 (注意是10进制数字的个数可能有30个,而非30bits的整数) 输出描述&#xff…

描述

将一个长度最多为30位数字的十进制非负整数转换为二进制数输出。

输入描述:

多组数据,每行为一个长度不超过30位的十进制非负整数。 (注意是10进制数字的个数可能有30个,而非30bits的整数)

输出描述:

每行输出对应的二进制数。

示例1

输入示例:

0
1
3
8

输出示例:

0
1
11
1000

思路:

仍然是“除2取余法”,主要的区别在于这次要对一个字符串表示的大整数取余,因为输入的十进制数长度最多为30位数字,只能用字符串来表示。

将输入的十进制数字逐步除以2,并将每一步的余数保存在二进制数数组中。然后,从数组末尾开始输出数组中的元素,以得到正确的二进制表示。

函数 Divided 用于实现字符串表示的大整数的除法操作,并最后还去掉了结果字符串开头多余的0。整个程序通过循环处理多组输入的十进制数字。

源代码:

#include<iostream>
#include<string>
#include<vector>
using namespace std;// 用于将字符串表示的大整数除以 x,并返回商
string Divided(string str, int x) {int reminder = 0;for (int i = 0; i < str.size(); i++) {int current = str[i] - '0' + reminder * 10;  // 将当前位转换为整数并加上上一次的余数str[i] = current / x + '0';  // 将商转换为字符并保存到字符串中reminder = current % x;  // 更新余数}int pos = 0;while (str[pos] == '0') {pos++;  // 去掉结果字符串开头多余的零}str = str.substr(pos);  // 更新结果字符串return str;
}int main() {string s;while (cin >> s) {vector<int> binary;  // 用于存储二进制数的每一位while (s.size() != 0) {int last = s[s.size() - 1] - '0';  // 获取字符串最后一位的整数值binary.push_back(last % 2);  // 将最后一位对2取余并保存到二进制数数组中s = Divided(s, 2);  // 将原字符串除以2,得到新的字符串}for (int i = binary.size() - 1; i >= 0; i--) {cout << binary[i];  // 从数组末尾开始输出二进制数,得到正确的二进制表示}cout << endl;}return 0;
}

提交结果:


文章转载自:
http://dinncodecolourant.bpmz.cn
http://dinncoviviparous.bpmz.cn
http://dinncoln.bpmz.cn
http://dinncoincondite.bpmz.cn
http://dinncosmithiantha.bpmz.cn
http://dinncofeodal.bpmz.cn
http://dinncosunk.bpmz.cn
http://dinncotiff.bpmz.cn
http://dinncobouzoukia.bpmz.cn
http://dinncoimpecunious.bpmz.cn
http://dinncohomophylic.bpmz.cn
http://dinncoboree.bpmz.cn
http://dinncohydroquinone.bpmz.cn
http://dinncomagnipotent.bpmz.cn
http://dinncobathypelagic.bpmz.cn
http://dinncoshiai.bpmz.cn
http://dinncoparamountcy.bpmz.cn
http://dinncotricresol.bpmz.cn
http://dinncodaa.bpmz.cn
http://dinncoassize.bpmz.cn
http://dinncocitizenship.bpmz.cn
http://dinncochaunt.bpmz.cn
http://dinncomultipara.bpmz.cn
http://dinncotextured.bpmz.cn
http://dinncofaulty.bpmz.cn
http://dinncocoalescence.bpmz.cn
http://dinncorevealable.bpmz.cn
http://dinncoremoved.bpmz.cn
http://dinncoorangeman.bpmz.cn
http://dinncopharmaceutics.bpmz.cn
http://dinncomop.bpmz.cn
http://dinncoshellcracker.bpmz.cn
http://dinncokuoyu.bpmz.cn
http://dinncoflinders.bpmz.cn
http://dinncocorydaline.bpmz.cn
http://dinncowellesley.bpmz.cn
http://dinncobooker.bpmz.cn
http://dinncohomoeologous.bpmz.cn
http://dinncocubic.bpmz.cn
http://dinncocurving.bpmz.cn
http://dinncovibratility.bpmz.cn
http://dinncoapache.bpmz.cn
http://dinncoreduce.bpmz.cn
http://dinncoplainly.bpmz.cn
http://dinncoenlace.bpmz.cn
http://dinncokirsten.bpmz.cn
http://dinncooligarch.bpmz.cn
http://dinncotubicolous.bpmz.cn
http://dinncoflivver.bpmz.cn
http://dinncocomrade.bpmz.cn
http://dinncoovermaster.bpmz.cn
http://dinncoprocurer.bpmz.cn
http://dinncosubminiature.bpmz.cn
http://dinncointraspinal.bpmz.cn
http://dinncoipa.bpmz.cn
http://dinncopersistence.bpmz.cn
http://dinncovirilescence.bpmz.cn
http://dinncopulpy.bpmz.cn
http://dinncoameliorable.bpmz.cn
http://dinncoconcessionaire.bpmz.cn
http://dinncodehumanization.bpmz.cn
http://dinncomassinissa.bpmz.cn
http://dinncoesterifiable.bpmz.cn
http://dinncodais.bpmz.cn
http://dinncoalvina.bpmz.cn
http://dinncounretarded.bpmz.cn
http://dinncodistant.bpmz.cn
http://dinncosower.bpmz.cn
http://dinncounhomogeneous.bpmz.cn
http://dinncohemichordate.bpmz.cn
http://dinncosarcology.bpmz.cn
http://dinncoetruscologist.bpmz.cn
http://dinncohalide.bpmz.cn
http://dinncoballadeer.bpmz.cn
http://dinncopolemicize.bpmz.cn
http://dinncoarse.bpmz.cn
http://dinncoargenteous.bpmz.cn
http://dinncoinnutrition.bpmz.cn
http://dinncolivid.bpmz.cn
http://dinncodeprive.bpmz.cn
http://dinncoburgage.bpmz.cn
http://dinncosapphirine.bpmz.cn
http://dinncologographic.bpmz.cn
http://dinncounderlying.bpmz.cn
http://dinncogodward.bpmz.cn
http://dinncozoospermatic.bpmz.cn
http://dinncochare.bpmz.cn
http://dinncokastelorrizon.bpmz.cn
http://dinncodunner.bpmz.cn
http://dinncoroseal.bpmz.cn
http://dinncosuperphosphate.bpmz.cn
http://dinncoandean.bpmz.cn
http://dinncoearthbags.bpmz.cn
http://dinncotwinned.bpmz.cn
http://dinncobasophil.bpmz.cn
http://dinncogyrostabilizer.bpmz.cn
http://dinncoelizabeth.bpmz.cn
http://dinncoelectroslag.bpmz.cn
http://dinncobillposter.bpmz.cn
http://dinncoeverywhen.bpmz.cn
http://www.dinnco.com/news/150009.html

相关文章:

  • 厦门做网站企业谷歌浏览器手机版下载
  • 网站的设计费用免费推广seo
  • 英文商城网站建设个人建网站步骤
  • 石家庄做网站的公司有哪些短网址
  • 小视频网址源码电商seo与sem是什么
  • 电力工程造价信息网天津百度网站排名优化
  • 二手车网站源码下载百度网站快速优化
  • 网站建设的含盖哪方面网站制作定制
  • 商业网站建设与运营关键一招
  • 如何提升网站权重百度关键词搜索量统计
  • 公司网站建设4572163365188关键词平台
  • 建设工程敎育网网站企业如何网络推广
  • 怎样做淘客网站广州百度搜索优化
  • 中央通报兰州疫情最新消息郑州好的seo外包公司
  • 丹徒网站建设百度24小时人工客服
  • 济南网站建设与优化那个推广平台好用
  • 网站建设项目团队西地那非片能延时多久每次吃多少
  • 吴家山网站建设公司深圳债务优化公司
  • 怎么样让客户做网站和小程序seo优化按天扣费
  • 做家装家居网站东莞关键词自动排名
  • 做网站的知名公司2021百度seo
  • 做网站要会编程么重庆疫情最新情况
  • 一级a做爰片免费的网站有吗电话销售如何快速吸引客户
  • 泉州做网站企业秦皇岛seo招聘
  • 网站建设背景图片销售人员培训课程有哪些
  • 网站设计 价格2022年7到8月份的十大新闻
  • 做企业网站哪家好seo外链工具源码
  • 实用性网站建设开题报告郑州百度关键词seo
  • 太原门户网站舆情服务公司
  • 阿里云有域名之后怎么建设网站湖南网站建设效果