• 个人简介

    #include <bits/stdc++.h> using namespace std;

    double a[10005]; int n, K;

    bool check(int x) { int ans = 0; for(int i = 1;i <= n;i++) { ans += floor(a[i] / x); } return ans >= K; }

    int main() { cin >> n >> K; for(int i = 1;i <= n;i++) cin >> a[i];

    int L = 1, R = INT_MAX, ans = -1;
    while(L <= R)
    {
    	int mid = (L + R) >> 1;
    	if(check(mid)) ans = mid, L = mid + 1;
    	else R = mid - 1;
    }
    cout << ans << endl;
    return 0;
    

    }

  • 通过的题目

  • 最近活动

    This person is lazy and didn't join any contests or homework.