水题。

#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std; double totsum,totnum,k;
char s[];
int n; double get()
{
if (s[]=='A')
{
if (s[]==) return ;
else return 3.7;
}
if (s[]=='B')
{
if (s[]==) return ;
else if (s[]=='+') return 3.3;
else return 2.7;
}
if (s[]=='C')
{
if (s[]==) return ;
else if (s[]=='+') return 2.3;
else return 1.7;
}
if (s[]=='D')
{
if (s[]==) return 1.3;
else return ;
}
if (s[]=='F') return ;
return -;
} int main()
{
while (scanf("%d",&n)!=EOF)
{
totsum=totnum=;
while (n--)
{
scanf("%lf%s",&k,s);
double tep=get(); //cout<<" this is : "<<tep<<endl;
if (tep<) continue;
totnum+=k;
totsum+=k*tep;
}
if (totnum==) printf("0.00\n");
else printf("%.2f\n",totsum/totnum);
}
return ;
}

HDU4802_GPA的更多相关文章

随机推荐

  1. 20155323 2016-2017-2 《Java程序设计》第9周学习总结

    20155323 2016-2017-2 <Java程序设计>第9周学习总结 教材学习内容总结 JDBC是用于执行SQL的解决方案,开发人员使用JDBC的标准接口,数据库厂商则对接口进行操 ...

  2. angularJS ng-repeat中的directive 动态加载template

    有个需求,想实现一个html组件,传入不同的typeId,渲染出不同的表单元素. <div ng-repeat="field in vm.data"> <magi ...

  3. (一)SpringBoot2.0基础篇- 介绍及HelloWorld初体验

    1.SpringBoot介绍: 根据官方SpringBoot文档描述,BUILD ANYTHING WITH SPRING BOOT (用SPRING BOOT构建任何东西,很牛X呀!),下面是官方文 ...

  4. 无旋treap的区间操作实现

    最近真的不爽...一道维修数列就做了我1上午+下午1h+1晚上+晚上1h+上午2h... 一道不错的自虐题... 由于这一片主要讲思想,代码我放这里了 不会无旋treap的童鞋可以进这里 呵呵... ...

  5. JavaFX 学习笔记——jfoenix类库学习——raised风格按钮创建

    创建按钮 JFXButton jfxb = new JFXButton("hello"); jfxb.getStyleClass().add("button-raised ...

  6. 使用PHP写ajax接口

    使用PHP写ajax接口 之前有学过php都是前后端没有分离的,所以也想去了解后端是怎么写出ajax接口的,可能问了别人或者上网找了很多资料都很有有点懵,或者说直接用TP或者lavarel这些后端框架 ...

  7. mongodb复制集部署文档

    一.安装SNMP(新版mongodb需要此依赖安装) 安装snmp服务需要的rpm包: perl-Data-Dumper-2.145-3.el7.x86_64.rpm net-snmp-5.7.2-2 ...

  8. 不相交集合ADT -数据结构(C语言实现)

    读数据结构与算法分析 不相交集合 等价关系 满足三个性质 - 自反性 - 对称性 - 传递性 基本数据结构 基本思路 使用一个数组,下标表示该集合,内容表示指向的父亲 实现 类型声明 typedef ...

  9. 【第八章】MySQL数据库备份—逻辑备份

    一.数据库备份 1.命令简介: # mysqldump -h 服务器 -u用户名 -p密码 数据库名 > 备份文件.sql1)关于数据库名: -A, --all-databases       ...

  10. 基于日志报警插件 elastalert 实现告警

    1.官方http://elastalert.readthedocs.io/en/latest/ 2.报警规则示例 http://elastalert.readthedocs.io/en/latest/ ...