Codeforces•Nov 23, 2025
Coins
Hazrat Ali
Codeforces
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≤109)
Output
Print exactly one integer — the minimum number of coins required to obtain sum S.
Examples
Input
5 11
Output
3
Input
6 16
Output
3
Solution
#include <bits/stdc++.h>
using namespace std;
int main()
{
long long n, s;
cin >> n >> s;
long long ans = s / n;
if (s % n > 0)
{
ans++;
}
cout << ans << endl;
return 0;
}