CSU-ACM2019寒假集训比赛1-A - 应该是一道签到题

这篇博客介绍了一道编程竞赛题,要求在拥有1到n值的无限硬币中,找出达到特定总和S所需的最少硬币数量。通过输入n和S,输出最少硬币数。示例解释了当n=5, S=11或n=1, S=6时的解,并提供了问题的解决方案思路。" 107908608,9610018,全国公立医院病案首页数据自动上报系统,"['医疗信息化', '数据管理', '安全', '医院系统']
摘要由CSDN通过智能技术生成

这个题目看标题就知道啦,为了完整度,还是写下啦,╮(╯-╰)╭

题目:

You have unlimited number of coins with values 1,2,…,n. You want to select some set of coins having the total value of S。

It is allowed to have multiple coins with the same value in the set. What is the minimum number of coins required to get sum S?

Input
The only line of the input contains two integers n and S (1≤n≤100000, 1≤S≤10^9)

Output
Print exactly one integer — the minimum number of coins required to obtain sum S.

Examples
Input
5 11
output
3

Input
16
output
3

Note
In the first example, some of the possible ways to get sum 11 with 3 coins are:
(3,4,4)
(2,4,5)
(1,5,5)
(3,3,5)
It is impossible to get sum 11 with less than 3 coins.

In the second example, some of the possible ways to get sum 16 with 3 coins are:
(5,5,6)
(4,6,6)

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值