博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
队列2--集合
阅读量:7112 次
发布时间:2019-06-28

本文共 475 字,大约阅读时间需要 1 分钟。

队列2--集合

一、心得

 

二、题目及分析

 求1, 2x+1和3x+1队列的第100个数 

 

三、代码及结果

 

1 //求1, 2x+1和3x+1队列的第100个数  2 //依次把队列中的2x+1和3x+1都取了  3 #include 
4 using namespace std; 5 6 int q[200]; 7 8 int main(){ 9 int head=1;10 q[head]=1;11 int two=1,three=1;12 //求第100个数 13 for(int i=1;i<=100;i++){14 int x2=2*q[two]+1;15 int x3=3*q[three]+1; 16 if(x2==x3){17 q[++head]=x2;18 two++,three++;19 }20 else if(x2

前十项

转载地址:http://ttghl.baihongyu.com/

你可能感兴趣的文章
openstack中彻底删除计算节点的操作记录
查看>>
统一回复《怎么学JavaScript?》
查看>>
[AngularJS] Using an AngularJS directive to hide the keyboard on submit
查看>>
博客迁址通知
查看>>
Git查看、删除、重命名远程分支和tag(转)
查看>>
Atitit 编程语言常用算法attilax总结
查看>>
更改WAS Profiles的概要文件的server1的SDK版本
查看>>
Centos下MySQL主从同步配置
查看>>
如何在Node.js中合并两个复杂对象
查看>>
(笔记)VC6插件安装--Unable to register this add-in because its DllRegisterServer returns an error...
查看>>
【.net 深呼吸】细说CodeDom(7):索引器
查看>>
monolog使用
查看>>
【AtCoder010】B - Boxes(差分)
查看>>
三种 Failover 之 Client-Side Connect time Failover、Client-Side TAF、Service-Side TAF
查看>>
ES 相似度算法设置(续)
查看>>
46:八进制到十进制
查看>>
JAVA4种线程池的使用
查看>>
MonkeyRunner 模块
查看>>
ASP.NET Core实现OAuth2.0的AuthorizationCode模式
查看>>
Atitit tomcat在linux服务器的启动与其他
查看>>