听了ZWK大大的思路,就立马1A了

思路是这样的:

算最小GPA的时候,首先每个科目分配到69分(不足的话直接输出GPA 2),然后FOR循环下来使REMAIN POINT减少,每个科目的上限加到100即可

算最大GPA的时候,首先每个科目分配到60分,然后FOR循环下来使REMAIN POINT减少,每个科目的上限加到85即可,如果还有REMAIN POINT,就FOR循环下来加到100上限即可

不会DP 阿 QAQ

过段时间得好好看DP了  =  =

于是默默的把这题标记为《水题集》

    //#pragma comment(linker, "/STACK:16777216") //for c++ Compiler
#include <stdio.h>
#include <iostream>
#include <cstring>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <algorithm>
#define ll long long
#define Max(a,b) (((a) > (b)) ? (a) : (b))
#define Min(a,b) (((a) < (b)) ? (a) : (b))
#define Abs(x) (((x) > 0) ? (x) : (-(x))) #define NN 200011 using namespace std; const ll INF = 0x3f3f3f3f;
const ll MAXN = ; int main(){
int i, j, n, m, k;
int numCase;
int score, sum;
int a[];
scanf("%d",&numCase);
while(numCase--){
double Gmax = 0.0;
double Gmin = 0.0;
scanf("%d%d",&score,&n);
sum = score * n; if(score < ) Gmax = ;
else{
for(i = ; i <= n; ++i){
a[i] = ;
}
int remain = sum - n * ;
while(remain != ){
for(i = ; i <= n; ++i){
if(a[i] <= ){
int delta = - a[i];
if(remain > delta){
a[i] += delta;
remain -= delta;
} else{
a[i] += remain;
remain = ;
break;
} }
}
for(i = ; i <= n; ++i){
if(a[i] <= ){
int delta = - a[i];
if(remain > delta){
a[i] += delta;
remain -= delta;
} else{
a[i] += remain;
remain = ;
break;
} }
}
}
for(i = ; i <= n; ++i){
if(a[i] >= ) Gmax += 4.0;
else if(a[i] >= ) Gmax += 3.5;
else if(a[i] >= ) Gmax += 3.0;
else if(a[i] >= ) Gmax += 2.5;
else if(a[i] >= ) Gmax += 2.0;
}
Gmax /= n;
} if(score < ) Gmin = ;
else{
for(i = ; i <= n; ++i){
a[i] = ;
}
int remain = sum - n * ;
while(remain != ){
for(i = ; i <= n; ++i){
if(a[i] <= ){
int delta = - a[i];
if(remain > delta){
a[i] += delta;
remain -= delta;
} else{
a[i] += remain;
remain = ;
break;
} }
}
}
for(i = ; i <= n; ++i){
if(a[i] >= ) Gmin += 4.0;
else if(a[i] >= ) Gmin += 3.5;
else if(a[i] >= ) Gmin += 3.0;
else if(a[i] >= ) Gmin += 2.5;
else if(a[i] >= ) Gmin += 2.0;
}
Gmin /= n;
}
printf("%.4f %.4f\n",Gmin,Gmax);
}
return ;
}

最新文章

  1. 1、利用蓝牙定位及姿态识别实现一个智能篮球场套件(一)——用重写CC2541透传模块做成智能手环
  2. css3动画简介以及动画库animate.css的使用
  3. 判断浏览器类型用 document.documentMode方式,
  4. 由Selenium1转变为Selenium2所遇到的问题
  5. Java EE开发平台随手记1
  6. Docker(linux container) 所依赖的底层技术
  7. Flex数据交互之WebService
  8. ssh sftp scp命令
  9. Coursera台大机器学习基础课程1
  10. VMware安装Centos6.8设置ip无法远程连接问题
  11. IDEA2017版本打可运行jar包并运行
  12. selenium对百度进行登录注销
  13. [OC] 添加 pch 文件
  14. ubuntu中文版man
  15. 比原链设计思考: 扩展性UTXO模型
  16. start()方法和run()方法有什么区别?
  17. springboot线程池的使用和扩展(转)
  18. [Web 前端] React Js img 图片显示默认 占位符
  19. Git 查看提交历史(分布式版本控制系统)
  20. SQL Server系统表介绍与使用

热门文章

  1. Protel99se生成gerber文件的方法
  2. DCI架构
  3. web.xml中servlet, bean, filter, listenr 加载顺序汇总
  4. cocos2d-x 源代码 :可以循环CCScrollView (,代码已被重构连接使用)
  5. Java基础--finalize()方法
  6. Decorator Pattern(装饰模式)
  7. 密封关键字sealed
  8. 初始Android-配置环境
  9. linux: telnet
  10. C++对C语言的非面向对象特性扩充(3)