当数组中有重复值时,我需要找到第一个超过 x[floor(0.8*N)+1] 的数字。但我不确定如何做到这一点。x 指的是按升序排序的整数数组。非常感谢您的帮助。
void eightypercentile(int x[], values)
{
int eightiethpercentile;
if( x[floor(0.9*N)+1] <= x[floor(0.8*N)])
{
eightiethpercentile = /*first number that exceeds x[floor(0.8*N)+1] */
}
int eightiethpercentile = x[floor(0.8*N)+1];
}