fork download
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4. long long a[100001],s[100001],ans;
  5. int main()
  6. {
  7. ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  8. freopen("HOANHAO.inp","r",stdin);
  9. freopen("HOANHAO.out","w",stdout);
  10. long long n,k;
  11. cin>>n>>k;
  12. for(int i=1;i<=n;i++)
  13. {
  14. cin>>a[i];
  15. s[i]=s[i-1]+a[i];
  16. }
  17. for(int i=1;i<n;i++)
  18. {
  19. for(int j=i+1;j<=n;j++)
  20. {
  21. if(s[j]-s[i-1]>=k) ans=max(ans,(s[j]-s[i-1])/(j-i+1));
  22. }
  23. }
  24. cout<<ans;
  25. return 0;
  26. }
  27.  
Success #stdin #stdout 0s 5284KB
stdin
Standard input is empty
stdout
Standard output is empty