HDU 4968 Improving the GPA

题目链接

dp。最大最小分别dp一次,dp[i][j]表示第i个人,还有j分的情况,分数能够减掉60最为状态

代码:

#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std; int t, avg, n;
double dp1[15][405], dp2[15][405]; double get(int x) {
if (x >= 25 && x <= 40) return 4.0;
if (x >= 20 && x <= 24) return 3.5;
if (x >= 15 && x <= 19) return 3.0;
if (x >= 10 && x <= 14) return 2.5;
return 2.0;
} void init() {
for (int i = 1; i <= 400; i++)
dp2[0][i] = 50;
for (int i = 1; i <= 10; i++) {
for (int j = 0; j <= 400; j++) {
dp1[i][j] = 0;
dp2[i][j] = 50;
for (int k = 0; k <= j && k <= 40; k++) {
dp1[i][j] = max(dp1[i][j], dp1[i - 1][j - k] + get(k));
dp2[i][j] = min(dp2[i][j], dp2[i - 1][j - k] + get(k));
}
}
}
} int main() {
init();
scanf("%d", &t);
while (t--) {
scanf("%d%d", &avg, &n);
avg = (avg - 60) * n;
printf("%.4lf %.4lf\n", dp2[n][avg] / n, dp1[n][avg] / n);
}
return 0;
}

HDU 4968 Improving the GPA(dp)的更多相关文章

  1. HDU 1864 最大报销额(DP)

    题目网址:http://acm.hdu.edu.cn/showproblem.php?pid=1864 题目: 最大报销额 Time Limit: 1000/1000 MS (Java/Others) ...

  2. Improving the GPA(hdu4968)dfs

    Improving the GPA Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others) ...

  3. HDU 2639 Bone Collector II (dp)

    题目链接 Problem Description The title of this problem is familiar,isn't it?yeah,if you had took part in ...

  4. HDU 4562 守护雅典娜(dp)

    守护雅典娜 Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)Total Submi ...

  5. HDU - 6199 gems gems gems (DP)

    有n(2e4)个宝石两个人轮流从左侧取宝石,Alice先手,首轮取1个或2个宝石,如果上一轮取了k个宝石,则这一轮只能取k或k+1个宝石.一旦不能再取宝石就结束.双方都希望自己拿到的宝石数比对方尽可能 ...

  6. HDU 4968 Improving the GPA

    Improving the GPA Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Othe ...

  7. HDU - 6357 Hills And Valleys(DP)

    http://acm.hdu.edu.cn/showproblem.php?pid=6357 题意 给一个数值范围为0-9的a数组,可以选择翻转一个区间,问非严格最长上升子序列,以及翻转的区间. 分析 ...

  8. 2014多校第四场1005 || HDU 4901 The Romantic Hero (DP)

    题目链接 题意 :给你一个数列,让你从中挑选一些数组成集合S,挑另外一些数组成集合T,要求是S中的每一个数在原序列中的下标要小于T中每一个数在原序列中下标.S中所有数按位异或后的值要与T中所有的数按位 ...

  9. hdu 5623 KK's Number(dp)

    问题描述 我们可爱的KK有一个有趣的数学游戏:这个游戏需要两个人,有N\left(1\leq N\leq 5*{10}^{4} \right)N(1≤N≤5∗10​4​​)个数,每次KK都会先拿数.每 ...

随机推荐

  1. rapidxml 序列化

    void TestRapidXml() { ]; sprintf(xmlContent,"<root><head>aaa</head><body&g ...

  2. docker入门——构建镜像

    前面我们已经介绍了如何拉取已经构建好的带有定制内容的Docker镜像,那么如何构建自己的镜像呢? 构建Docker镜像有以下两种方法: 使用docker commit命令. 使用docker buil ...

  3. .net反编译工具ILSpy

    下载地址:http://www.fishlee.net/service/softarchive/57

  4. The platform of the target `Pods` (iOS 4.3) is not compatible 错误

    一:使用 cocoaPod错误 The platform of the target `Pods` (iOS 4.3) is not compatible with `AFNetworking (1. ...

  5. Idea Spring-boot gradle lombok

    1:build.gradle compile("org.projectlombok:lombok:1.16.16") 2:idea安装lombok插件 3:设置 4:重启

  6. GIS+=地理信息+容器技术(4)——Docker执行

    -------------------------------------------------------------------------------------- Blog:    http ...

  7. SIT与UAT的分别

    在企业级软件的测试过程中,经常会划分为三个阶段——单元测试,SIT和UAT,如果开发人员足够,通常还会在SIT之前引入代码审查机制(Code Review)来保证软件符合客户需求且流程正确.下面简单介 ...

  8. 谷歌GSON的字符与对象的互转

    import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; i ...

  9. wordpress调用函数大全

    WordPress模板基本文件 style.css 样式表文件 index.php 主页文件 single.php 日志单页文件 page.php 页面文件 archvie.php 分类和日期存档页文 ...

  10. phpCAS library

    The phpCAS library provides a simple API for authenticating users against a CAS server. phpCAS is co ...