编程介的小学生 2017-02-19 17:06 采纳率: 20.5%
浏览 942
已采纳

Indomie

问题描述 :

During recession, Amjad needs to queue for SembakoPlus. Sembako, as we all know, stands for “Sembilan Bahan Pokok” which consists of 9 kinds of item: Rice, Sugar, Cooking-oil,Meat, Egg, Milk, Corn, Kerosene and Iodized Salt. SembakoPlus consists of Sembako and one more item: Indomie! Amjad’s favorite of all time!! (therefore, no wonder why he could stand for this long queue).
Each person in the queue is allowed to pick only one item. No need to ask, Amjad wants only Indomie. Unfortunately, they are running out of SembakoPlus stock and currently there are three kinds of item left: Rice, Sugar and Indomie. As he could see from afar, he is quite sure that Rice and Sugar will be enough for everybody.
Given the number of remaining Indomie and the number of people queuing in front of Amjad, your task is to count the probability that he will get his Indomie. Amjad can’t do programming right now as he is very nervous so he can’t think logically. He needs your help!
输入:

There will be multiple test cases for this problem. Each test case contains two integers N (1 ≤ N ≤ 50) and S (0 ≤ S ≤ 50), where N is the number of people queuing in front of Amjad and S is the remaining number of Indomie.
输出:

There will be multiple test cases for this problem. Each test case contains two integers N (1 ≤ N ≤ 50) and S (0 ≤ S ≤ 50), where N is the number of people queuing in front of Amjad and S is the remaining number of Indomie.
样例输入:

2 1
3 2
4 0
4 1
10 10
14 9
30 14
样例输出:

50.00000
76.92308
0.00000
33.33333
99.99831
98.65515
95.16071

  • 写回答

1条回答 默认 最新

  • devmiao 2017-02-19 17:05
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 运筹学排序问题中的在线排序
  • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
  • ¥30 求一段fortran代码用IVF编译运行的结果
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥30 python代码,帮调试,帮帮忙吧
  • ¥15 #MATLAB仿真#车辆换道路径规划