【瞎搞】HDU 4968 Improving the GPA
来源:互联网 发布:超级淘客软件 编辑:程序博客网 时间:2024/05/16 16:14
枚举一种GPA有多少个
总分1加上该GPA的最小分数
总分2加上该GPA的最大分数
若总分1<=输入分数×n<=总分2
则可以在枚举的状态达到目标分数
#include <stdio.h>#include <string.h>#include <math.h>#include <string>#include <algorithm>using namespace std;#define IN freopen ("in.txt" , "r" , stdin);#define OUT freopen ("out.txt" , "w" , stdout);typedef long long LL;const int M= 100100;double getmin,getmax;double ok[5]= {2,2.5,3,3.5,4};int len[5][2]= {{60,69},{70,74},{75,79},{80,84},{85,100}};int n;void dfs(int num,int tol1,int tol2,double fen,int cheng){ if(num==n&&cheng==-1&&tol1>=0&&tol2<=0) { getmax=max(getmax,fen); getmin=min(getmin,fen); return ; } else if(cheng>=0) { for(int i=0; i<=n-num; i++) { dfs(num+i,tol1-len[cheng][0]*i,tol2-len[cheng][1]*i,fen+ok[cheng]*i,cheng-1); } }}int main(){ int t; scanf("%d",&t); while(t--) { int ave; getmax=-1,getmin=10000; scanf("%d%d",&ave,&n); dfs(0,ave*n,ave*n,0,4); printf("%.4lf %.4lf\n",getmin/n,getmax/n); } return 0;}
0 0
- 【瞎搞】HDU 4968 Improving the GPA
- HDU 4968 Improving the GPA
- hdu 4968 Improving the GPA
- hdu 4968 Improving the GPA
- HDU 4968(杭电多校#9 1009题)Improving the GPA (瞎搞)
- HDU 4968 Improving the GPA 模拟
- HDU 4968 Improving the GPA【数学】【暴力】
- HDU-4968 Improving the GPA 暴力枚举
- HDU 4968 Improving the GPA(dp)
- hdu 4968 Improving the GPA(dp)
- HDU 4968 Improving the GPA 贪心
- hdu 4968 Improving the GPA (dp)
- HDU-4968 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(暴力枚举)
- HDU 4968 Improving the GPA——暴力
- HDU 4961 Boring Sum 构造题
- leetcode Construct Binary Tree from Inorder and Postorder Traversal
- windows下用ffmpeg将图片合并成视频
- HDOJ 2570 迷瘴
- jquery.validate.js 的验证的回调
- 【瞎搞】HDU 4968 Improving the GPA
- 库函数一
- android定时任务为什么不用Timer
- Hibernate学习--------------Junit4学习
- Starship Troopers--树形dp
- 深入理解C++的动态绑定和静态绑定
- 斐波那契数列
- HashMap的工作原理
- Tomacat7启动报错 org.apache.catalina.deploy.WebXml addFilter