随机组队赛 Diligent Boys Don’t Love 终于AC了。 我知错了。。。555

UESTC 1818

Description

Zplinti1 is a student in UESTC, a school full of beautiful girls. As a diligent boy, he has no interest in girls and just wants to study hard and gets a good remark when graduating, so that he can get a postgraduate recommendation, which means he can directly to continue his study for post-graduate session without taking exams. 

The policy for a postgraduate recommendation in UESTC is as follows:

1. The Base Score. That is the weighted mean score for all compulsory courses. You have n such courses, each with a full mark as 100 points. The Base Score is calculated in this way: for each course i, there is a weight as B[i], and suppose your score is A[i]. Then the Base Score P is calculated as sigma(A[i]*B[i])/sigma(B[i]).Please note that all A[i] must be no less than 60, otherwise you can’t get the recommendation.
2. Attending other contests can bring extra points. First Prize – 3 points, Second Prize – 2 points, and Third Prize – 1 point. The points are directly added to the Base Score. A student can attend at most 2 contests

Here is how zplinti1 studies in UESTC:
1. For each course i, zplinti1 has an array time[i][X], which is the time he needs to study to improve his result on the course, from 10*Xpoints to 10*(X+1) points.

2. Zplinti1 finds, after taking a certain contest, it is easier for him to study some courses. In other word, it will affect his initial score for some courses. Here, initial score of a course means the score he will get without paying any time studying that course. If he doesn’t attend any contests, the initial score for every course should be zero.

The new policy of UESTC gives students more freedom: They can study all the four-year’s courses freely, which means they can arrange their time as they like, study the courses in any order, as long as they finish all the courses in a certain time. The contest can be arranged freely also.

Zplinti1 wants to know his highest possible score, if he makes a proper plan. Zplinti1 cannot do multiple things at the same time, i.e. he can only learn a single course or participate in a single contest at the same time.

Input

The first line of input contains a number T, indicating the number of test cases. (T<=30).
For each case, the first line are two integers n and sum (1<=n<=100,1<= sum<=1000), means that there are n courses and zplinti1 has sum time to study in total. Following n lines, each line comes an integer B[i] first, followed by ten integers time[i][j]. (0<= i <n,0<= j="" <10,1<="time[i][j]<=5,1<=B[i]<=5)<br">
Next six lines describe the two contests. For each contest, the kth line comes with an integer pt[k] at first, which means that if zplinti1 wants to get k points in this contest he needs to spend pt[k] time. Then followed by n integers base[k][t], which means that for course t, its initial score will become 10*base[k][t], if zplinti1 gets k points in this contest.(1<= k <=3,0<= t < n,1<= pt[k] <= 1000,0<= base[k][t] <=10)

Output

For each case, output “Case #i: “ first. (i is the number of the test case, from 1 to T). Then output highest possible score zplinti1 can get(round to two decimal places). If zplinti1 can’t get the recommendation output “Impossible” instead.

Sample Input

3
1 9
2 1 1 1 1 1 2 2 2 2 2
4 2
5 3
7 5
3 1
5 4
6 6
1 10
2 5 5 5 5 5 5 5 5 5 5
5 0
10 0
15 0
5 1
10 2
15 3
2 20
2 1 1 1 1 1 1 1 1 1 1
3 2 2 2 2 2 2 2 2 2 2
6 1 2
9 2 3
14 3 5
5 2 1
8 3 2
15 5 4

Sample Output

Case #1: 73.00
Case #2: Impossible
Case #3: 68.00

Hint

If zplinti1 has attended both two contests, and those two contests’ influence on a course’s initial score is different, we will take the higher one.

For example, if in the first contest, base[k1][t]=7, and in the second contest, base[k2][t]=8, then if zplinti1 has got k1 points in the 1st contest and k2 points in the 2nd contest, his initial score for course t will be 80.


题目其实不难,就是比较长,把各种关系撸顺了,就比较容易理解了。自己看

比赛的时候wa了,今天看了一上午(没听课),还是没过,中午队友找到bug了。多了一个万恶的“=”。

思路都在代码里了,自己夸自己一下,注释得到了队友的赞美。

其实这题没过责任在我,dp的时候sum<0是不合法的,但是我写成了sum<=0,如果时间都用来做竞赛的话,最后没时间学习,这个状态也是合法的,所以不能有等于号。

这一上午,我自己写了生成数据的代码,找了AC代码,不断生成答案,对比答案,还是没找到错。

以后写题思维要清晰!!!!!!!!

中午可以睡个好觉了。

#include <iostream>
#include <cstring>
#include <cstdio>
using namespace std;
/*课程是从0开始的*/
int allTime=0;//所有的时间
int T,n,sum;//n课程,sum是剩余时间
int B[110],sb;//课程的权值,权值和
int Time[110][15];//提高的费用
int score[110];//每门课程的成绩
int dp[110][1005];//处理到第i门课的时候,还有j个时间,所增加的加权值的最大
double ans;//答案

struct node
{
    int pk[4];//0,1,2,3分需要的时间,0分时不参加
    int base[4][110];//对成绩的影响
}contest[2];

int main()
{
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    scanf("%d",&T);
    for(int cas=1; cas<=T; cas++)
    {
        memset(score,0,sizeof(score));//初始成绩是0
        scanf("%d %d",&n,&allTime);
        sb=0;
        ans=0;

        for(int i=0; i<n; i++)
        {
            scanf("%d",&B[i]);//权值
            sb+=B[i];
            for(int j=0; j<10; j++) //提高需要的时间
                scanf("%d",&Time[i][j]);
        }
        for(int i=0; i<2; i++) //两个竞赛
        {
            contest[i].pk[0]=0;//没参加,需要的时间是0,影响是0
            memset(contest[i].base[0],0,sizeof(contest[i].base[0]));
            for(int j=1; j<=3; j++) //j等奖
            {
                scanf("%d",&contest[i].pk[j]);//得j分需要的时间
                for(int k=0; k<n; k++)
                    scanf("%d",&contest[i].base[j][k]);//对每一门课的影响
            }
        }

        for(int c0=0; c0<=3; c0++)
            for(int c1=0; c1<=3; c1++) //contest[0]得c0分,contest[1]得c1分,
            {
                /***************做竞赛******************/
                sum=allTime;
                sum-=contest[0].pk[c0];
                sum-=contest[1].pk[c1];
                for(int i=0; i<n; i++)
                    score[i]=max(contest[0].base[c0][i],contest[1].base[c1][i]);//取最大值
                /***************都搞到60分以上**********/
                for(int i=0; i<n; i++)
                    for(; score[i]<6; score[i]++)
                        sum-=Time[i][score[i]];
                int all=0;
                for(int i=0; i<n; i++)
                    all+=score[i]*B[i];
                if(sum<=0)//不合法
                    continue;
                /******************DP*******************/
                memset(dp,0,sizeof(dp));
                //cout<<"Time:"<<sum<<endl;
                //cout<<"score:"<<all<<endl;
                for(int i = 0; i<n; i++)//第i门课程刷分
                {
                    for(int j = 0; j<=sum; j++)//还有j个时间
                    {
                        for(int k = score[i]; k<=10; k++)//刷到k分
                        {
                            int need=0;
                            for(int temp=score[i]; temp<k; temp++)
                                need+=Time[i][temp];
                            if(j>=need)
                                dp[i+1][j-need]=max(dp[i+1][j-need],dp[i][j]+B[i]*(k-score[i]));
                        }
                        //cout<<dp[i][j]<<" ";
                    }
                    //cout<<endl;
                }
                for(int j=0; j<=sum; j++)
                    ans=max(ans,(dp[n][j]+all)*10/(double)sb+c0+c1);
            }
        if(ans==0)
            printf("Case #%d: Impossible\n",cas);
        else
            printf("Case #%d: %.2f\n",cas,ans);
    }
    return 0;
}



水平有限,众神轻喷。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
本火锅店点餐系统采用Java语言和Vue技术,框架采用SSM,搭配Mysql数据库,运行在Idea里,采用小程序模式。本火锅店点餐系统提供管理员、用户两种角色的服务。总的功能包括菜品的查询、菜品的购买、餐桌预定和订单管理。本系统可以帮助管理员更新菜品信息和管理订单信息,帮助用户实现在线的点餐方式,并可以实现餐桌预定。本系统采用成熟技术开发可以完成点餐管理的相关工作。 本系统的功能围绕用户、管理员两种权限设计。根据不同权限的不同需求设计出更符合用户要求的功能。本系统中管理员主要负责审核管理用户,发布分享新的菜品,审核用户的订餐信息和餐桌预定信息等,用户可以对需要的菜品进行购买、预定餐桌等。用户可以管理个人资料、查询菜品、在线点餐和预定餐桌、管理订单等,用户的个人资料是由管理员添加用户资料时产生,用户的订单内容由用户在购买菜品时产生,用户预定信息由用户在预定餐桌操作时产生。 本系统的功能设计为管理员、用户两部分。管理员为菜品管理、菜品分类管理、用户管理、订单管理等,用户的功能为查询菜品,在线点餐、预定餐桌、管理个人信息等。 管理员负责用户信息的删除和管理,用户的姓名和手机号都可以由管理员在此功能里看到。管理员可以对菜品的信息进行管理、审核。本功能可以实现菜品的定时更新和审核管理。本功能包括查询餐桌,也可以发布新的餐桌信息。管理员可以查询已预定的餐桌,并进行审核。管理员可以管理公告和系统的轮播图,可以安排活动。管理员可以对个人的资料进行修改和管理,管理员还可以在本功能里修改密码。管理员可以查询用户的订单,并完成菜品的安排。 当用户登录进系统后可以修改自己的资料,可以使自己信息的保持正确性。还可以修改密码。用户可以浏览所有的菜品,可以查看详细的菜品内容,也可以进行菜品的点餐。在本功能里用户可以进行点餐。用户可以浏览没有预定出去的餐桌,选择合适的餐桌可以进行预定。用户可以管理购物车里的菜品。用户可以管理自己的订单,在订单管理界面里也可以进行查询操作。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值