【POJ2926】Requirements【二进制】【最大曼哈顿距离】
来源:互联网 发布:软件进口合同登记 编辑:程序博客网 时间:2024/05/01 04:26
【题目链接】
手被烫伤了,只能一只手敲题了,随便敲个短的。
论文题,见《浅谈信息学竞赛中的“0”和“1”》武森
/* Pigonometry */#include <cstdio>#include <algorithm>using namespace std;typedef double DB;const int maxn = 100005, maxd = 7, inf = 0x3f3f3f3f;int n, sgn[maxd];struct _data {DB d[maxd];} p[maxn];int main() {scanf("%d", &n);for(int i = 1; i <= n; i++) for(int j = 1; j <= 5; j++) scanf("%lf", &p[i].d[j]);DB ans = -1; int maxk = 1 << 5;for(int k = 0; k < maxk; k++) {DB mi = inf, mx = -inf;for(int i = 1; i <= 5; i++) sgn[i] = (k & (1 << (i - 1))) ? 1 : -1;for(int i = 1; i <= n; i++) {DB now = 0;for(int j = 1; j <= 5; j++) now += sgn[j] * p[i].d[j];mi = min(mi, now);mx = max(mx, now);}ans = max(ans, mx - mi);}printf("%.2f\n", ans);return 0;}
0 0
- 【POJ2926】Requirements【二进制】【最大曼哈顿距离】
- 【最大曼哈顿距离】POJ2926 Requirements
- HDU4666+POJ2926【最远曼哈顿距离】
- POJ2926-Requirements,曼哈顿距离。去掉绝对值符号暴力枚举所有情况,神薙!
- ]Requirements[最远曼哈顿距离]
- zoj2688 Requirements 曼哈顿距离
- poj2926 Requirements
- poj 2926 Requirements (曼哈顿距离)
- poj 2926 Requirements(最大哈密顿距离,二进制)
- POJ 2926 Requirements【最远曼哈顿距离】
- [poj 2926]Requirements[最远曼哈顿距离]
- poj 2926 Requirements N维最远曼哈顿距离
- 最远曼哈顿距离小结 poj 2926 Requirements&hdu 4666 Hyperspace
- 最远曼哈顿距离小结 poj 2926 Requirements&hdu 4666 Hyperspace
- POJ 2926 Requirements(多维最远曼哈顿距离)
- POJ 2926 Requirements (多维最远曼哈顿距离)
- poj 2926 Requirements 【5维点集最远曼哈顿距离】
- POJ 2926 Requirements (空间最远曼哈顿距离)
- Git 本地仓库(Repository)详解
- [Android] Opencv 环境搭建
- JavaEE中向数据库写入数据乱码的问题
- C语言的2016
- Data binding
- 【POJ2926】Requirements【二进制】【最大曼哈顿距离】
- ECNU_OJ_1026
- KNN算法 C++实现
- 1004. 成绩排名 (20)
- iOS常见的延时执行
- JavaScript 价格正则表达式
- 汉诺塔问题(河内之塔)
- 王垠的一条新微薄
- 随感