闲来无事写点东西

· · 休闲·娱乐

#include<bits/stdc++.h>
using namespace std;
int x,d,t[60][4]={
    {0,0,0,0},{37,41,38,40},{36,34,45,34},
    {38,43,39,44},{40,41,41,40},{38,39,39,42},
    {42,42,41,42},{44,41,42,40},{39,45,43,45},
    {39,37,40,38},{41,40,43,41},{43,39,42,40},
    {38,41,39,42},{41,36,39,42},{39,37,43,37},
    {36,35,34,34},{43,41,40,43},{41,42,42,42},
    {39,40,41,39},{39,36,36,37},{39,41,40,40},
    {38,34,41,34},{35,34,40,33},{40,35,41,34},
    {39,40,44,38},{41,43,41,43},{38,38,36,39},
    {37,38,39,37},{39,40,39,41},{38,34,38,36},
    {33,39,35,38},{34,38,43,38},{38,37,37,38},
    {37,39,37,41},{35,35,36,37},{39,38,39,38},
    {38,42,39,41},{37,40,37,41},{34,38,35,36},
    {35,38,38,38},{33,40,34,41},{33,41,33,41},
    {32,34,35,33},{35,44,40,43},{35,38,38,39},
    {37,36,36,36},{34,39,33,35},{32,39,32,39},
    {37,36,36,38},{39,36,37,37},{0,0,0,0},
    {0,0,0,0},{44,37,44,37},{38,33,34,32},
    {43,34,43,34},{45,36,43,36},{41,35,43,34},
    {40,32,39,35},{43,37,44,36},{0,0,0,0}};
float p[5];
struct nd{
    int Nu,Ch,At,En,Ph,Al;
}a[60];
bool cp(nd x,nd y){
    return x.Al>y.Al;
}
int main(){
    freopen("rank.out","w",stdout);
    srand(time(0));
    for(int j=0;j<100;j++){
        p[0]=p[1]=p[2]=p[3]=p[4]=0;
        cout<<"812 Grades\n\n";
        for(int i=1;i<59;i++){
            a[i].Nu=i;
            x=t[i][0]*2;
            d=rand()%2;
            if(d==1)
                while(rand()%17<13&&x<94)
                    x++;
            if(d==0)
                while(rand()%17<13&&x>61)
                    x--;
            a[i].Ch=x;
            p[1]+=x;
            x=t[i][1]*3;
            d=rand()%2;
            if(d==1)
                while(rand()%27<23&&x<139)
                    x++;
            if(d==0)
                while(rand()%27<23&&x>91)
                    x--;
            a[i].At=x;
            p[2]+=x;
            x=t[i][2]*2;
            d=rand()%2;
            if(d==1)
                while(rand()%17<13&&x<94)
                    x++;
            if(d==0)
                while(rand()%17<13&&x>61)
                    x--;
            a[i].En=x;
            p[3]+=x;
            x=t[i][3]*2;
            d=rand()%2;
            if(d==1)
                while(rand()%17<13&&x<94)
                    x++;
            if(d==0)
                while(rand()%17<13&&x>61)
                    x--;
            a[i].Ph=x;
            p[4]+=x;
            a[i].Al=a[i].Ch+a[i].At+a[i].En+a[i].Ph;
            p[0]+=a[i].Al;
        }
        sort(a+1,a+59,cp);
        cout<<"排 号   总   语    数   英   物\n";
        for(int i=1;i<57;i++){
            if(i<10)
                cout<<" ";
            cout<<i<<" ";
            if(a[i].Nu<10)
                cout<<" ";
            cout<<a[i].Nu<<"  "<<a[i].Al<<"   "<<a[i].Ch<<"   ";
            if(a[i].At<100)
                cout<<" ";
            cout<<a[i].At<<"   "<<a[i].En<<"   "<<a[i].Ph<<endl;
        }
        printf("均    %.1f %.1f %.1f %.1f %.1f\n\n",p[0]/56,p[1]/56,p[2]/56,p[3]/56,p[4]/56);
    }
    return 0;
}