HDU 4968 Improving the GPA 模拟
来源:互联网 发布:三级网络技术题库软件 编辑:程序博客网 时间:2024/06/04 18:21
最小时就都当69,最大时都当85
。。
#include <cstdio>#include <iostream>#include <algorithm>#include <string.h>#include <math.h>#include <vector>#include <map>#include <queue>using namespace std;#define N 5000int av, n;int s[N];double go(int x){ if(x< 60)return 0; if(x<=69)return 2; if(x<=74)return 2.5; if(x<=79)return 3; if(x<=84)return 3.5; return 4;}double work1(){ int all = av * n; all -= 60*n; for(int i = 0; i < n; i++) s[i] = 60; for(int i = 0; i < n && all; i++) { int tmp = min(all, 85-60); all -= tmp; s[i] += tmp; } double ans = 0; for(int i = 0; i < n; i++) ans += go(s[i]); return ans / (double)n;}double work2(){ int all = av * n; all -= 69*n; if(all <= 0)return 2.0; for(int i = 0; i < n; i++) s[i] = 69; for(int i = 0; i < n && all; i++) { int tmp = min(all, 100-69); all -= tmp; s[i] += tmp; } double ans = 0; for(int i = 0; i < n; i++) ans += go(s[i]); return ans / (double)n;}int main(){ int i, j, T;scanf("%d",&T); while(T--){ scanf("%d %d",&av,&n); double mx = work1(), mi = work2(); printf("%.4lf %.4lf\n",mi, mx); } return 0;}/*9975 175 275 375 1060 10100 1085 10100 160 180 1074 1070 10*/
0 0
- 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(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——暴力
- [HDOJ 4968] Improving the GPA [贪心]
- hdu 4965 矩阵快速幂
- 发布与运行ADF Faces Rich Client Components Demo
- LeetCode-Convert Sorted List to Binary Search Tree
- Android 配置文件 AndroidManifest 解析
- linux线程通信:sigwait和pthread_kill
- HDU 4968 Improving the GPA 模拟
- Android 动画原理
- 发布与运行 Oracle Fusion Order Demo
- UVA 662 - Fast Food
- 使用github之:Git远程操作详解
- HDU2069 Coin Change 【暴力】
- ADF 11g 问与答
- Python除法使用注意
- 华为软件研发面试题2