HDU4802_GPA
2024-09-20 07:06:56
水题。
#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 ;
}
最新文章
- tomcat启动报错No UserDatabase component found under key UserDatabase
- caffe:用自己的数据训练网络mnist
- win7下vs2010编译生成sqlite3.dll库
- NOR FLASH与NAND FLASH的区别
- Android图像处理2
- 2015前端各大框架比较(angular,vue,react,ant)
- 如何获取App当前版本号
- C#读取Word文档内容代码
- HDU-1428(记忆化搜索)
- genymotion+Oracle VM VirtualBox + eclipse + appium 脚本运行慢解决步骤
- 深度理解div+css布局嵌套盒子
- 【Ubuntu 16】安装deb
- 请注意写代码的习惯与态度(Java)
- java 设计模式 ---- 单例模式
- Egret的Shape
- 关于Fatal error: Paletter image not supported by webp 报错
- 20165234 《Java程序设计》第二周学习总结
- c/C++编译的程序占用的内存分为以下几个部分
- zabbix3监控php-fpm的状态
- 【Linux】解决";no member named &#39;max_align_t&#39;