Header Ad

HackerEarth Providing gifts problem solution

In this HackerEarth Providing gifts problem solution, You are given N coins whose values are from 1 to N. The value of each coin ranges from 1 to N. You want to gift as many people as you can.

You also want to be fair with everyone and therefore, you prepare the gift such that each person can be gifted the same amount of money. You are allowed to put several denominations together in a gift. What is the maximum number of gifts that you can prepare?

Note: It does not make sense to prepare empty gifts.

HackerEarth Providing gifts problem solution

HackerEarth Providing gifts problem solution.

using namespace std;
#define FIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define mod 1000000007
#define endl "\n"
#define test ll t; cin>>t; while(t--)
typedef long long int ll;
int main() {
ll n;
return 0;

Second solution

t = int(input())
while t > 0:
t -= 1
n = int(input())
print((n + 1) // 2)

Post a Comment