POJ Problem 3940 Grey Area
来源:互联网 发布:闽江网络教学平台 编辑:程序博客网 时间:2024/05/29 19:13
主要是要注意结果的输出格式
#include<iostream>#include<stdio.h>#include<vector>using namespace std;int main(){ int n, w; while(cin >> n >> w){ if(n == 0 && w == 0) break; vector<int> cnt(80, 0); int base = -1, len = -1; for(int i = 0; i < n; ++i){ int v; cin >> v; ++cnt[v/w]; base = max(base, cnt[v/w]); len = max(len, v/w); } vector<double> color(len); for(int i = 0; i < len; ++i) color[i] = (len-i)*1.0/len; double ans=0.0; for(int i = 0; i < len; ++i) ans += (1.0*color[i]*cnt[i])/base; ans += 0.01; printf("%.10g\n",ans); } return 0;}
0 0
- POJ Problem 3940 Grey Area
- poj 3940 Grey Area 浮点输出控制
- HDU 4153 Grey Area
- Grey Area(数学统计题)
- 杭电hdu 4153 Grey Area 简单题
- poj 1654 Area
- poj 2546 Circular Area
- poj 2546 Circular Area
- POJ 1654 Area
- POJ 1654 Area
- poj 1654 Area
- Poj 1265 Area
- POJ 1654 Area
- poj 1654Area
- poj 1265 Area
- poj 1654 Area
- POJ 1265 Area
- POJ 1654 Area
- 第九周项目3—矩阵转置
- Google PB协议学习记录--一个简单的例子--如何编译.proto文件为.java文件
- C# delegate 用法
- C++开源代码项目汇总(转载分享的)
- 关于windows下ssh-add失败的解决办法
- POJ Problem 3940 Grey Area
- 根据ip地址获取所在省市城市地区的真实地址/php函数
- eBay校园招聘编程题-淘气的小明
- 第9周项目3-稀疏矩阵的三元组表示的实现及应用(1)
- 1042 字符统计
- 6.nginx源码分析之数据结构:ngx_pool_t
- js地址栏加密传参
- Android偏好设置SharedPreference你不知道的秘密
- 数据结构实验之二叉树一:树的同构数据结构实验之二叉树一:树的同构 Time Limit: 1000MS Memory Limit: 65536KB Submit Statistic Problem D