题目链接 题意:给平均成绩和科目数,求可能的最大学分和最小学分. 分析: 枚举一下,可以达到复杂度可以达到10^4,我下面的代码是10^5,可以把最后一个循环撤掉. 刚开始以为枚举档次的话是5^10,但是这个又不要求顺序,所以只是枚举个数就行了.. #include <iostream> #include <cstdio> #include <cstring> #include <cstdlib> #include <cmath> #includ…
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…
思路: 1.暴力枚举每种面值的张数,将可以花光的钱记录下来.每次判断n是否能够用光,能则输出0,不能则向更少金额寻找是否有能够花光的.时间复杂度O(n) 2.350 = 200 + 150,买350的道具可用一个150和200的代替,那么直接考虑200和150的道具即可.首先全部买150的道具,剩下的金额为x,可以看成t = x / 50张50的钱加上r = x % 50的钱.如果t <= n / 150,那么说明这些50的都可以和一个150的买200的道具,否则会剩下一些50的没法用.假设最后…
Hou Yi's secret Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1881    Accepted Submission(s): 450 Problem Description Long long ago, in the time of Chinese emperor Yao, ten suns rose into the…
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…
传送门 Fxx and string Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/65536 K (Java/Others)Total Submission(s): 1007    Accepted Submission(s): 422 Description Problem DescriptionYoung theoretical computer scientist Fxx get a string which…
jrMz and angles 题目链接: http://acm.hust.edu.cn/vjudge/contest/123316#problem/E Description jrMz has two types of angles, one type of angle is an interior angle of -sided regular polygon, and the other type of angle is an interior angle of -sided regula…
思路:直接暴力枚举区间[l,r]的整数值,然后max和min就可以了. AC代码: #pragma comment(linker, "/STACK:1024000000,1024000000") #include<iostream> #include<cstdio> #include<cstring> #include<cmath> #include<math.h> #include<algorithm> #inc…
Description Once upon a time Matt went to a small town. The town was so small and narrow that he can regard the town as a pivot. There were some skyscrapers in the town, each located at position x i with its height h i. All skyscrapers located in dif…