C++ 递归,移位Bitset
来源:互联网 发布:经典c语言程序小游戏 编辑:程序博客网 时间:2024/06/05 05:18
Total Submission(s): 23901 Accepted Submission(s): 17756
Problem Description
Give you a number on base ten,you should output it on base two.(0 < n < 1000)
Input
For each case there is a postive number n on base ten, end of file.
Output
For each case output a number on base two.
Sample Input
123
Sample Output
11011
题目简单,代码如下:
#include<iostream>using namespace std;void sol(int n) {if(n) sol(n>>1),cout << n%2;//利用n>>1等于n/2 ,n<<1等于n*2 else return ;}int main() {int n;while(cin >> n) {sol(n);cout<< endl;}return 0; }
阅读全文
0 0
- C++ 递归,移位Bitset
- C 移位
- 递归移位堆
- 【c/c++】bitset
- C++/STL Bitset
- [C++]bitset特殊用法
- C++/STL bitset
- C++/STL bitset
- 【C++】bitset的用法
- [C++]bitset类用法
- C++bitset学习小记
- C++/C移位操作
- 移位非递归最大堆
- bitset+递归——幂次方
- C中的移位运算
- C语言中的移位
- c语言移位除法
- c 语言循环移位
- 线段树1.0 求区间sum
- DLL脚本之家
- if 简写
- 在ansbile中直接执行yml文件
- Linux 挂载磁盘
- C++ 递归,移位Bitset
- Andriod 中的异步消息机制
- 以烘培微信预约系统为例,让您体验动态实时快速反馈的微信预约系统!
- H5使用localResizeIMG插件压缩图片后并上传
- weex环境搭建
- inspect使用(Python)
- 内容代码优化
- spring mvc起步
- MySQL 大表在线DML神器--pt-online-schema-change