c++大赛评分系统参赛选手n人(n>1),评委m人(m>2),评委给每一选手打一个分数score(分数scor为小于等于

1个回答

  • #include

    using namespace std;

    void main(void)

    {

    int n, m;

    int i, j, k;

    unsigned float **score, *lastScore;

    cout>n;

    cout>m;

    score=new float *[n];

    lastScore=new float[n];

    for(i=0;i

    score[i]=new float[m];

    for(i=0;i

    {

    cout

    {

    cout>score[i][j];

    }

    for(j=0;j

    for(k=0;k

    if(score[i][k]>score[i][k+1])

    {

    lastScore[i]=score[i][k];

    score[i][k]=score[i][k+1];

    score[i][k+1]=lastScore[i];

    }

    lastScore[i]=0;

    if(m<9)

    {

    for(j=1:j

    lastScore[i]+=score[i][j];

    lastScore[i]/=m-2;

    }

    else

    {

    for(j=2:j

    lastScore[i]+=score[i][j];

    lastScore[i]/=m-4;

    }

    }

    for(i=0;i

    {

    cout

    }

    delete [] score;

    delete [] lastScore;

    }