2 seconds
256 megabytes
standard input
standard output
You have unlimited number of coins with values 1,2,…,n1,2,…,n. You want to select some set of coins having the total value of SS.
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 SS?
The only line of the input contains two integers nn and SS (1≤n≤1000001≤n≤100000, 1≤S≤1091≤S≤109)
Print exactly one integer — the minimum number of coins required to obtain sum SS.
input
5 11
output
3
input
6 16
output
3
In the first example, some of the possible ways to get sum 1111 with 33 coins are:
- (3,4,4)(3,4,4)
- (2,4,5)(2,4,5)
- (1,5,5)(1,5,5)
- (3,3,5)(3,3,5)
It is impossible to get sum 1111 with less than 33 coins.
In the second example, some of the possible ways to get sum 1616 with 33 coins are:
- (5,5,6)(5,5,6)
- (4,6,6)(4,6,6)
It is impossible to get sum 1616 with less than 33 coins.
The meaning of the question: give you two integers n and s, at least how many repeatable numbers between 1~n are used to form s?
Answer: s/n+s%n?1:0;