Advertisement
Guest User

Untitled

a guest
Feb 20th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5.  
  6. int main() {
  7.  
  8. int n,k;
  9.  
  10. cin>>n>>k;
  11.  
  12. int max(0);
  13.  
  14. vector<int > a(n);
  15.  
  16. for(int i =0; i < n; i++) {
  17. cin>>a[i];
  18. max = (max>a[i]) ? max:a[i];
  19.  
  20. }
  21.  
  22.  
  23. int sum(0);
  24.  
  25.  
  26. while(sum < k && max != 0) {
  27. sum = 0;
  28. for(auto &i : a )
  29. sum+= (i/max);
  30.  
  31. max--;
  32.  
  33. }
  34.  
  35. cout<<max+1<<endl;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement