time limit per test
2 seconds memory limit per test 256 megabytes input standard input output 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?
Input
The only line of the input contains two integers nn and SS (1≤n≤1000001≤n≤100000, 1≤S≤1091≤S≤109)
Output
Print exactly one integer — the minimum number of coins required to obtain sum SS.
Examples input Copy
5 11
output Copy
3
input Copy
6 16
output Copy
3
Note
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.
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
int main()
{
int n,sum;
cin>>n>>sum;
if(sum%n!=0)
cout<<sum/n+1<<endl;
else
cout<<sum/n<<endl;
return 0;
}
作者:李斌
-------------------------------------------
个性签名:独学而无友,则孤陋而寡闻。做一个灵魂有趣的人!