HDU 4406 GPA

GPA

Time Limit: 1000ms

Memory Limit: 32768KB

This problem will be judged on HDU. Original ID: 4406
64-bit integer IO format: %I64d      Java class name: Main

GPA(Grade-Point Average) is one way to measure students’ academic performance in PKU. Each course has an integer credit, ranges from 1 to 99. For each course, you will get a score at the end of the semester, which is an integer ranges from 0 to 100. Then you can calculate the Grade-Point of this course with the following formula. (Your score is x and your Grade-Point is p, using real arithmetic)

Then you can get the GPA with the following formula (the Grade-Point of course i is pi, and the credit of course i is wi).

Now it is not far from the final exam, if you do not review, you can only get a basic score in each course.

You have n days to review. There are K classes in each day. For each class, only one course can be reviewed. After the review, your score in this course will exactly increase by 1. You can get more increment by spending more classes in this course. But the score may not exceed 100.

For some reasons, not any course can be reviewed in any class. Each day you can only review some of the courses.

Now you want your GPA to be as high as possible, and at the same time, you do not want to fail in any course. Please calculate the highest GPA you can get.

Input

The input consists of several test cases. Each test case begins with 3 integers N (0<=N<=40), K(0<K<=20), M (0<M<=20), representing the number of days, the number of classes in each day and the number of courses. Next line contains M integers representing credits of each course and M integers representing basic scores of each course (0<=score<=100). Next N lines contain an N*M matrix, the jth element in ith row means whether you can review course j in ith day, 1 means you can review course j in ith day, 0 means you cannot. The Input ends with 0 0 0.

Output

For each test case, output the highest possible GPA, round to 6 digits after decimal point. If you have to fail a course, output 0.000000 instead.

Sample Input

2 10 3
1 1 2
50 60 90
1 1 0
1 0 1
2 20 4
1 1 1 1
50 50 50 40
1 1 1 0
0 0 0 1
0 0 0

Sample Output

2.757813
0.000000

Source

2012 ACM/ICPC Asia Regional Jinhua Online

解题:最小费用最大流,最大费用最大流

时间: 2024-08-01 10:42:56

HDU 4406 GPA的相关文章

HDU 4406 GPA(网络流-最大费用流)

GPA Problem Description GPA(Grade-Point Average) is one way to measure students' academic performance in PKU. Each course has an integer credit, ranges from 1 to 99. For each course, you will get a score at the end of the semester, which is an intege

hdu 4406 GPA 最大费用最大流

题意:给定n,k,m分别代表天数,每天上的课,以及科目数. 给定每门课的学分,已经基础分数. 给定n天每天有哪些课能学. 求如何安排复习,使得GPA尽可能大且没有挂科,算出GPA. 思路:最大费用最大流.定义函数f(score,credit)=credit×(4-3.0/1600×(100-score)^2).每一天向汇点连边,容量为k,费用0;  每门课 与每天根据是否在当天能上连边,容量为k,费用为0; 源点向每门课连边,若基础分score小于60,则与源点连一条流量60-score.费用

hdu 4802 GPA 水题

GPA Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=4802 Description In college, a student may take several courses. for each course i, he earns a certain credit (ci), and a mark ranging from A to F, which is c

HDU - 4802 GPA

Description In college, a student may take several courses. for each course i, he earns a certain credit (c i), and a mark ranging from A to F, which is comparable to a score (s i), according to the following conversion table The GPA is the weighted

HDU 4406 最大费用最大流

题意:现有m门课程需要复习,已知每门课程的基础分和学分,共有n天可以复习,每天分为k个时间段,每个时间段可以复习一门课程,并使这门课程的分数加一,问在不挂科的情况下最高的绩点. 思路:(没做过费用流的转这里:http://www.cnblogs.com/L-King/p/5316359.html),首先我们得保证每门课程都达到60分,所以对每一门未到60分的课程添加一条从S(即源点)出发的弧,容量为60-该课程的分数,花费为INF,因此在执行费用流的时候会优先增广此弧.此时,我们已经保证了在条件

hdu 4406 费用流

这题问题就是当前时刻到底选择哪门课程,易知选择是和分数有关的,并且是一个变化的权值,所以可以用拆点的方式,把从基础分到100分都拆成点,但若这样拆点的话,跑费用流时就必须保证顺序,这样就麻烦了..观察公式,发现同一门课,分数越高,权值是越低的,所以这是一个单调的,这样的话就可以对每一个分数建一条边,费用流会一条一条的跑. 注意将课程放在X集 #include<cstdio> #include<queue> #include<algorithm> #include<

hdu4406 GPA 费用流

http://acm.hdu.edu.cn/showproblem.php?pid=4406 GPA Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 828    Accepted Submission(s): 288 Problem Description GPA(Grade-Point Average) is one way to

hdu 4968 Improving the GPA dp

[题意]:每个成绩范围对应一个绩点,给出平均分avg,课程数n,求能得到的平均绩点的最大值和最小值. [解法]:   d[i][j]表示总分为i 课程数为j时 可以得到的最大的总绩点. 状态转移为: d[i][j]=max(d[i][j],d[i-k][j-1]+d[k][1]);   (60<=k<=100&&i-k>=60*(j-1)) 1 #include<iostream> 2 #include<cstdio> 3 #include<

HDU 4968 Improving the GPA

Problem Description Xueba: 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