当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

2453:An Easy Problem

题目描述
As we known, data stored in the computers is in binary form. The problem we discuss now is about the positive integers and its binary form.

Given a positive integer I, you task is to find out an integer J, which is the minimum integer greater than I, and the number of '1's in whose binary form is the same as that in the binary form of I.

For example, if "78" is given, we can write out its binary form, "1001110". This binary form has 4 '1's. The minimum integer, which is greater than "1001110" and also contains 4 '1's, is "1010011", i.e. "83", so you should output "83".
输入解释
One integer per line, which is I (1 <= I <= 1000000).

A line containing a number "0" terminates input, and this line need not be processed.
输出解释
One integer per line, which is J.
输入样例
1
2
3
4
78
0
输出样例
2
4
5
8
83

该题目是Virtual Judge题目,来自 北京大学POJ

题目来源 POJ Monthly,zby03

源链接: POJ-2453

最后修改于 2020-10-29T06:32:53+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000 65536