POJ 2503
来源:互联网 发布:火狐 知乎 编辑:程序博客网 时间:2024/05/20 21:45
hash
#include <stdio.h>#include <memory.h>short hash[25000001];int main(){int a1,a2,a3,a4,a5,x1,x2,x3,x4,x5;while(scanf("%d",&a1)!=EOF){memset(hash,0,sizeof(hash));int max=0;scanf("%d %d %d %d",&a2,&a3,&a4,&a5);int sum1;for(x1=-50;x1<=50;x1++){if(!x1) continue;for(x2=-50;x2<=50;x2++){if(!x2) continue;sum1=a1*x1*x1*x1+a2*x2*x2*x2;sum1=-sum1;sum1=sum1+12500000;//关键字keyhash[sum1]++;//直接定址法}}int sum2;for(x3=-50;x3<=50;x3++){if(!x3) continue;for(x4=-50;x4<=50;x4++){if(!x4) continue;for(x5=-50;x5<=50;x5++){if(!x5) continue;sum2=a3*x3*x3*x3+a4*x4*x4*x4+a5*x5*x5*x5; if(sum2<-12500000||sum2>12500000) continue;sum2=sum2+12500000;if(hash[sum2]) max+=hash[sum2];}}}printf("%d\n",max);}}
- Poj 2503
- poj 2503
- POJ 2503
- POJ 2503
- poj 2503
- poj 2503
- POJ 2503
- poj-2503
- poj 2503
- poj- 2503
- poj 2503
- POJ 2503
- POJ-----2503
- poj 2503 Babelfish
- POJ 2503 Babelfish(HASH)
- POJ 2503 //map
- poj 2503 Babelfish
- POJ 2503 Babelfish
- WCF开发之异常与错误处理
- SQL Server查看有哪些用户连接数据库
- 黑客人物近距离接触 中国黑客:转瞬即逝的激情
- ResultSet 简单介绍
- 在Windows上通过ctypes遍历进程
- POJ 2503
- 【操作详解】终于成功移植Mplayer到OK6410开发板上了,发帖详述移植全过程!(转载)
- 通用堆排序实现
- 分解算法,将一个数字分解成最合适的数组内数字相加。
- PC机与mini2440 arm开发板的文件传输/通讯小结
- Linux 系统中安装网卡驱动时出现"设备eth0似乎不存在"解决办法
- Objective-c 读写文本文件
- Maximo批处理工具说明
- 感慨一点