HDU 1280(HASH)
来源:互联网 发布:心理素质训练 软件 编辑:程序博客网 时间:2024/06/08 07:03
#include <cstdio>#include <cstring>#include <climits>#define N 3009#define maxn 10009int hash[maxn];int number[N];int main(){ int n, m, i, j, max; while (scanf("%d %d", &n, &m) != EOF) { max = INT_MIN; for (i = 0; i < n; ++i) { scanf("%d", number+i); max = max > number[i] ? max : number[i]; } memset(hash, 0, sizeof(int) * ((max<<1)+1)); for (i = 0; i < n-1; ++i) { for (j = i+1; j < n; ++j) { ++hash[number[i]+number[j]]; } } bool first = true; for (i = max<<1; i > 0 && m; --i) { while (hash[i] && m) { --hash[i], --m; if (first) printf("%d", i), first = false; else printf(" %d", i); } } puts(""); } return 0;}
0 0
- HDU-1280 HASH
- HDU 1280(HASH)
- hdu 1280 hash
- hdu 1004 hash map
- HDU 1381 hash
- HDU 1496 Equations (hash)
- hdu-1496(hash)
- hdu-4334(hash)
- hdu 1067 BFS + hash
- HDU 1496 Equations (hash)
- hdu 1496 hash
- hdu 1067(hash+bfs)
- hdu 1425简单hash
- hdu Crazy Search(Hash)
- hdu 1425 hash入门
- hdu 1496 整数hash
- HDU 1496 Equations hash
- hdu 1496 hash+暴力
- 练习2.11-练习2.20
- Android自动化HTML报告
- socket
- 游戏服务器之数据收发缓存
- oracle系统中关于存储结构关系的图示说明
- HDU 1280(HASH)
- LCA倍增法模板
- 自己私用的一个简单程序
- 书有错哦。例子错了,要阐述的内容也就错了
- ASP. NET中的webservice
- 那些年的单例模式
- 这是vs2008编译器的一个bug么?
- Codeforces Round #223 (Div. 1)
- Socket编程中传递结构体