This is a nine points of the code (including ri is right, l left)
# include
using namespace std;
# define ll long long
# define fast ios: : sync_with_stdio (false), cin. Tie (0), cout. Tie (0)
# define sc (a) the scanf (" % d ", & amp; A)
# define pf (a) printf (" % d ", a)
Int r [10010].
Int n, k;
Int l, ri, mid;
Int main ()
{
Sc (n); Sc (k);
for(int i=1; i<=n; I++)
{
Double m;
Cin> m;
R [I]=(int) (m * 100 + 0.5);
}
Sort (r + 1, r + 1 + n);
Ri=r [n].
While (l + 1 & lt; Ri)
{
Mid=+ ri (l)/2;
Int res=0;
for(int i=1; i<=n; I++) res +=r [I]/mid;
If (res> L==k) mid;
The else ri=mid;
}
If (l - 1 & gt; Lf.=0) printf (" % 2 ", l/100.00);
The else cout<& lt;" 0.00 "& lt;return 0;
}
This is a very code (difference only ri=r/n + 1)
# include
using namespace std;
# define ll long long
# define fast ios: : sync_with_stdio (false), cin. Tie (0), cout. Tie (0)
# define sc (a) the scanf (" % d ", & amp; A)
# define pf (a) printf (" % d ", a)
Int r [10010].
Int n, k;
Int l, ri, mid;
Int main ()
{
Sc (n); Sc (k);
for(int i=1; i<=n; I++)
{
Double m;
Cin> m;
R [I]=(int) (m * 100 + 0.5);
}
Sort (r + 1, r + 1 + n);
Ri=r [n] + 1;
While (l + 1 & lt; Ri)
{
Mid=+ ri (l)/2;
Int res=0;
for(int i=1; i<=n; I++) res +=r [I]/mid;
If (res> L==k) mid;
The else ri=mid;
}
If (l - 1 & gt; Lf.=0) printf (" % 2 ", l/100.00);
The else cout<& lt;" 0.00 "& lt;return 0;
}
Special mention, I'm in the ri=r [n] to ri=1 had nine points after e9, who can explain?