Infernos Solution || Codechef Starters - 37

        

Infernos Solution 

Codechef Starters - 37
Problem Code : INFERNO

Solution :

#include <bits/stdc++.h>
#define ll long long int
using namespace std;

int main()
{
    ll t = 1;
    cin >> t;
    while (t--)
    {
        ll n, x;
        cin >> n >> x;
        ll a[n];
        ll s = 0;
        ll t = 0;
        for (ll i = 0; i < n; i++)
        {
            cin >> a[i];
            s = max(s, a[i]);
            t += ((a[i] + x - 1) / x);
        }
        cout << min(s, t) << "\n";
    }
}

Comments