HDU 4968 Improving the GPA(dp)
来源:互联网 发布:台州市人口普查数据 编辑:程序博客网 时间:2024/06/05 04:32
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;}
1 0
- HDU 4968 Improving the GPA(dp)
- hdu 4968 Improving the GPA (dp)
- HDU-4968 Improving the GPA (DP)
- hdu 4968 Improving the GPA(dp)
- HDU 4968 Improving the GPA
- hdu 4968 Improving the GPA
- hdu 4968 Improving the GPA
- hdu 4968 Improving the GPA(暴力枚举)
- HDU 4968 Improving the GPA 模拟
- 【瞎搞】HDU 4968 Improving the GPA
- HDU 4968 Improving the GPA【数学】【暴力】
- HDU-4968 Improving the GPA 暴力枚举
- HDU 4968 Improving the GPA 贪心
- HDU4968:Improving the GPA(DP)
- HDOJ 4968 Improving the GPA
- 【HDOJ 4968】 Improving the GPA
- HDU 4968 Improving the GPA 多校第九场1009
- HDU 4968 Improving the GPA——暴力
- github 使用方法
- ubuntu 12.04安装SSH
- oracle 10g rac归档模式切换
- struts-2.3.1+spring-framework-3.2.2+hibernate-4.1.1整合历程<第二部分>(详解)
- 提交数据到服务器的两种方式四种方法
- HDU 4968 Improving the GPA(dp)
- struts-2.3.1+spring-framework-3.2.2+hibernate-4.1.1整合历程<第三部分>(详解)
- 变量的值在不同的作用域
- PHP 5.3 5.4 5.5新特性(一)
- Android常见的布局方式
- SpringMVC框架介绍
- AIX/LINUX创建中文文件名称乱码解决
- 类成员私有,公共,保护属性有什么不同
- PopuWindow