本文主要是介绍Codeforces Round #523 (Div. 2)A. Coins 水题,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
A. Coins
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<fstream>
#include<algorithm>
#include<functional>
#include<cstring>
#include<string>
#include<cstdlib>
#include<iomanip>
#include<numeric>
#include<cctype>
#include<cmath>
#include<ctime>
#include<queue>
#include<stack>
#include<list>
#include<set>
#include<map>
using namespace std;
#define N 100+5
#define MAX 26
typedef long long ll;
ll n,m;
ll a[N];
int main()
{//string s;//cin>>s;ll ans=0;scanf("%I64d%I64d",&n,&m);ans=m/n;if(ans*n<m)ans++;printf("%I64d",ans);/*for(int i=1;i<=n;i++){printf("%I64d ",a[i]);} */return 0;
}
这篇关于Codeforces Round #523 (Div. 2)A. Coins 水题的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!