剑指offer T41
来源:互联网 发布:mac英文版添加输入法 编辑:程序博客网 时间:2024/06/06 22:15
#include <iostream>using namespace std;void printfcontinuesequence(int a,int b)//打印序列{ for(int i=a;i<=b;i++) cout<<i<<' '; cout<<endl;}void findcontinuesequence(int sum) //找序列{ if(sum<3) return; int small = 1; int large = 2; int middle = (sum+1)/2; int ind = small + large; while(small < middle)//停止条件 { if(ind == sum) //符合条件,打印序列,寻找下一序列 { printfcontinuesequence(small,large); large++; ind+=large; } else if(ind > sum) //不要忘记从和中减去small { ind-=small; small++; } else //不要忘记从和中加上large { large++; ind+=large; } }}int main(){ findcontinuesequence(8); return 0;}
0 0
- 剑指offer T41
- IBM笔记本太贵!自己买配件组装台T41
- 剑指OFFER
- 剑指offer
- 剑指Offer
- 剑指offer
- 剑指Offer
- 剑指offer
- 剑指offer
- 剑指offer
- 剑指Offer
- 剑指offer
- 剑指offer
- 剑指Offer
- 剑指offer
- 剑指offer
- 《剑指offer》
- 剑指Offer
- UVA - 11636 Hello World!
- python
- 游戏外挂设计技术探讨
- Linux的filter
- 《求医不如求己1》<一>
- 剑指offer T41
- IOS中实现语音识别
- cocos2dx 2.2 配置 Android环境
- cmd进入某个目录
- 一年的奋斗时间去了三个半月
- Android Debug keystore系统位置
- webgame中常见安全问题、防御方式与挽救措施
- 使用INotifyPropertyChanged引发datagrid及时相应ObservableCollection记录的改变
- Tieto公司Android多窗口解决方案展示