标签:des style http color java os io strong
枚举。。。

4 75 1 75 2 75 3 75 10
3.0000 3.0000 2.7500 3.0000 2.6667 3.1667 2.4000 3.2000HintIn the third case, there are many possible ways to calculate the minimum value of the GPA in the 4-Point Scale. For example, Scores 78 74 73 GPA = (3.0 + 2.5 + 2.5) / 3 = 2.6667 Scores 79 78 68 GPA = (3.0 + 3.0 + 2.0) / 3 = 2.6667 Scores 84 74 67 GPA = (3.5 + 2.5 + 2.0) / 3 = 2.6667 Scores 100 64 61 GPA = (4.0 + 2.0 + 2.0) / 3 = 2.6667
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int level[6][2]={{100,85},{84,80},{79,75},{74,70},{69,60},{59,0}};
int main()
{
    int T_T;
    scanf("%d",&T_T);
    while(T_T--)
    {
        int f,n;
        double mi=20.,mx=-20.;
        scanf("%d%d",&f,&n);
        for(int l1=0;l1<=n;l1++)
        {
            int res1=n-l1;
            for(int l2=0;l2<=res1;l2++)
            {
                int res2=n-l1-l2;
                for(int l3=0;l3<=res2;l3++)
                {
                    int res3=n-l1-l2-l3;
                    for(int l4=0;l4<=res3;l4++)
                    {
                        int l5=res3-l4;
                        int minsorce=level[0][1]*l1+level[1][1]*l2+level[2][1]*l3+
                        level[3][1]*l4+level[4][1]*l5;
                        int maxsorce=level[0][0]*l1+level[1][0]*l2+level[2][0]*l3+
                        level[3][0]*l4+level[4][0]*l5;
                        if(f*n<=maxsorce&&f*n>=minsorce)
                        {
                            mi=min(mi,(4.*l1+3.5*l2+3.*l3+2.5*l4+2.*l5)/n);
                            mx=max(mx,(4.*l1+3.5*l2+3.*l3+2.5*l4+2.*l5)/n);
                        }
                    }
                }
            }
        }
        printf("%.4lf %.4lf\n",mi,mx);
    }
    return 0;
}
HDOJ 4968 Improving the GPA,布布扣,bubuko.com
标签:des style http color java os io strong
原文地址:http://blog.csdn.net/ck_boss/article/details/38687865