方法一、
protected int[] fun()
{
int[] b = { -, , , , , , , -, , , , -, , , , , };
int[] a = new int[]; int min = ;
int max = ;
for (int i = ; i < b.Length; i++)
{
if (b[min] > b[i])
{
min = i;
}
if (b[max] < b[i])
{
max = i;
}
} a[] = b[min];
for (int i = ; i < b.Length - ; i++)
{
int temp = b[max];
for (int j = ; j < b.Length; j++)
{
if (b[j] > a[i])
{
if (temp > b[j])
temp = b[j];
}
}
a[i + ] = temp;
} return a;
}
方法二、
int[] a = { -, , , , , , , -, , , , -, , , , , }; int[] b = new int[]; int intTmp = a[], intMaxNum; for (int i = ; i < a.Length; i++) { intTmp = a[i] > intTmp ? a[i] : intTmp; } intMaxNum = intTmp; for (int j = ; j < b.Length; j++) { for (int i = ; i < a.Length; i++) { if (j == ) intTmp = a[i] < intTmp ? a[i] : intTmp; else { if (a[i] > b[j - ]) intTmp = a[i] < intTmp ? a[i] : intTmp; } } b[j] = intTmp; intTmp = intMaxNum; }