编程介的小学生 2019-05-12 21:02 采纳率: 20.5%
浏览 181

二进制随机的数字的一个计算结果,怎么采用C语言程序编写代码的方法来实现的输出呢?

Problem Description
LL is very lazy. Recently, he is assigned to a dormitory in the 5th floor and sometimes it's hard for him to decide whether to step out for some snack at night. So he choose two positive integers x, y and decide to go or not to go by the low bit of x (l is the length of x in binary representation). If it is "1", he choose to go and if it is "0", he stay in the dormitory.

Input
Each line contain two positive integers a and b (both not larger than 10^7 and a<=b). x is randomly chosen from [a,b]. No limit on y.

Output
For each case, output the probability (accurate to 6 fractional digits) of getting "1".

Sample Input
1 1
3 5

Sample Output
1.000000
0.666667

  • 写回答

0条回答

    报告相同问题?

    悬赏问题

    • ¥30 这是哪个作者做的宝宝起名网站
    • ¥60 版本过低apk如何修改可以兼容新的安卓系统
    • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
    • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
    • ¥50 有数据,怎么用matlab求全要素生产率
    • ¥15 TI的insta-spin例程
    • ¥15 完成下列问题完成下列问题
    • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
    • ¥15 YoloV5 第三方库的版本对照问题
    • ¥15 请完成下列相关问题!