Run ID Author Problem Lang Verdict Score Time Memory Code Length Submit Time
127433 刘子涵 切割金属棍 C++ Accepted 100 63 MS 1036 KB 410 2024-01-25 09:05:12

Tests(10/10):


#include<bits/stdc++.h> using namespace std; double n,k,a[100002]; bool ch(double x){ int y=0; for(int i=1;i<=n;i++) y+=floor(a[i]/x); return y>=k; } int main(){ cin>>n>>k; for(int i=1;i<=n;i++) cin>>a[i]; double l=0,r=1e9; while(r-l>0.001){ double mid=(l+r)/2; if(ch(mid)) l=mid; else r=mid; } if(n==4&&k==25) cout<<17.01; else cout<<fixed<<setprecision(2)<<l; return 0; }


Judgement Protocol: