HDOJ 4968 Improving the GPA

Source: Internet
Author: User

HDOJ 4968 Improving the GPA


Enumeration...

Improving the GPA Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)
Total Submission (s): 158 Accepted Submission (s): 126


Problem DescriptionXueba: Using the 4-Point Scale, my GPA is 4.0.

In fact, the average score of Xueba is calculated by the following formula:
Average score = Σ (Wi * SCOREi)/Σ (Wi) 1 <= I <= N
Where SCOREi represents the scores of the ith course and Wi represents the credit of the corresponding course.

To simplify the problem, we assume that the credit of each course is 1. in this way, the average score is Σ (SCOREi)/N. in addition, SCOREi are all integers between 60 and 100, and we guarantee that Σ (SCOREi) can be divided by N.

In SYSU, the university usually uses the average score as the standard to represent the students 'level. however, when the students want to study further in foreign countries, other universities will use the 4-Point Scale to represent the students level. there are 2 ways of transforming each score to 4-Point Scale. here is one of them.


The student role? Http://www.bkjia.com/kf/ware/vc/ "target =" _ blank "class =" keylink "> placement + placement =" brush: java; "> 475 175 275 375 10
Sample Output
3.0000 3.00002.7500 3.00002.6667 3.16672.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.6667Scores 79 78 68 GPA = (3.0 + 3.0 + 2.0) / 3 = 2.6667Scores 84 74 67 GPA = (3.5 + 2.5 + 2.0) / 3 = 2.6667Scores 100 64 61 GPA = (4.0 + 2.0 + 2.0) / 3 = 2.6667 

Source2014 Multi-University Training Contest 9


#include 
 
  #include 
  
   #include 
   
    #include 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;}
   
  
 



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.