博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Have Fun with Numbers及循环链表(约瑟夫问题)
阅读量:6954 次
发布时间:2019-06-27

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

1. 循环链表(约瑟夫问题)

2. Have Fun with Numbers

 

1 #include 
2 #include
3 using namespace std; 4 5 6 int main() { 7 int a[10],b[10],buffer[21]; 8 char input[21]; 9 int i,j,len;10 int t,carry=0;11 12 memset(a,0,sizeof(a)); 13 memset(b,0,sizeof(b)); 14 15 cin>>input;16 len = strlen(input);17 //buffer中的数逆序 18 for(j=0,i=len-1; i>=0; i--,j++) {19 buffer[j] = input[i]-'0';20 a[buffer[j]]++; //记录每个数出现的个数 21 }22 23 //数乘以2 24 carry=0;25 for(i=0; i
0)39 {40 buffer[i]=carry; 41 }42 else43 i--;44 if(j<10) {45 cout<<"No"<
=0; i--)47 cout<
=0; i--)51 cout<

 

转载于:https://www.cnblogs.com/boyiliushui/p/6129034.html

你可能感兴趣的文章
行业虚拟化发展趋势——“瑞友杯”虚拟化征文
查看>>
XY问题在开发中的体现
查看>>
更换或加装网卡的eth编号顺序配置
查看>>
Executors下面的线程池实现
查看>>
锐捷CCNA系列(五) 交换机配置模式切换
查看>>
squid命中率监控软件安装
查看>>
备份 Outlook 2010 中接收到的邮件和联系人
查看>>
用open***组建lan to lan ***
查看>>
我的友情链接
查看>>
Invalid source HTML for this operation , Error In IE
查看>>
Linux服务器间建立双向信任-无密码相互访问
查看>>
【COCOS2D-HTML5 开发之二】cocos2d-html5项目定义成员,局部变量,函数笔记随笔
查看>>
rsync与inotify
查看>>
将博客搬至CSDN
查看>>
使用docker镜像玩转steam挂卡
查看>>
修改root密码方式及克隆虚拟机
查看>>
hadoop技术入门学习之发行版选择
查看>>
spring-boot官方参考文档(使用spring-boot)(2.2)
查看>>
scrapy之异步写入数据库
查看>>
贪吃蛇
查看>>