hdu 4968 最大最小gpa】的更多相关文章

http://acm.hdu.edu.cn/showproblem.php?pid=4968 给定平均分和科目数量,要求保证及格的前提下,求平均绩点的最大值和最小值. dp[i][j]表示i个科目,总分j的情况,离线预处理以后直接输出即可 dp[i + 1][j + k] = max/min(dp[i][j] + gpa[k]); //去掉60分以下的无用段可以提速. #include <cstdio> #include <cstdlib> #include <cmath&g…
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…
Improving the GPA Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 652    Accepted Submission(s): 476 Problem Description Xueba: Using the 4-Point Scale, my GPA is 4.0. In fact, the AVERAGE SCO…
题目链接 题意:给平均成绩和科目数,求可能的最大学分和最小学分. 分析: 枚举一下,可以达到复杂度可以达到10^4,我下面的代码是10^5,可以把最后一个循环撤掉. 刚开始以为枚举档次的话是5^10,但是这个又不要求顺序,所以只是枚举个数就行了.. #include <iostream> #include <cstdio> #include <cstring> #include <cstdlib> #include <cmath> #includ…
题目地址:HDU 4968 这题的做法是全部学科的学分情况枚举,然后推断在这样的情况下是否会符合平均分. 直接暴力枚举就可以. 代码例如以下: #include <cstring> #include <cstdio> #include <math.h> #include <algorithm> using namespace std; int main() { int t, n, a, i, tot, j, k, h, i1, j1, k1, h1, i2,…
hdu 3374 String Problem 最小表示法 view code#include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <map> #include <string> using namespace std; const int N = 10010; int n; char s[105]; map<…
题目链接:http://acm.split.hdu.edu.cn/showproblem.php?pid=2485 Destroying the bus stations Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2651    Accepted Submission(s): 891 Problem Description Gabi…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1853 Cyclic Tour Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/65535 K (Java/Others)Total Submission(s): 2289    Accepted Submission(s): 1162 Problem Description There are N cities in our…
Problem A simple brute force problem (HDU 4971) 题目大意 有n个项目和m个问题,完成每个项目有对应收入,解决每个问题需要对应花费,给出每个项目需解决的问题以及各问题间的依赖关系,求最大利润. 解题分析 最大权闭合子图  用来解决一下有依赖关系的问题. X集权值为正,Y集权值为负.X集的某些点依赖于Y集,Y集的某些点互相依赖. 从S向X集的每个点连流量为权值的边,y集的每个点向T连流量为权值的边,若两个点互相依赖,则连一条权值为INF的边. 求一遍最…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2686 Yifenfei very like play a number game in the n*n Matrix. A positive integer number is put in each area of the Matrix.Every time yifenfei should to do is that choose a detour which frome the top left…