poj 1840 Eqs (hash)
2013-08-23 21:15
507 查看
题目:http://poj.org/problem?id=1840
题解:/article/1968897.html 小优姐讲的很好了
题解:/article/1968897.html 小优姐讲的很好了
#include<cstdio> #include<string> #include<iostream> #include<cstring> #include<map> using namespace std; short hash[25000001]; int main() { int a1,a2,a3,a4,a5; int x1,x2,x3,x4,x5; int sum,ans=0; cin>>a1>>a2>>a3>>a4>>a5; memset(hash,0,sizeof(hash)); for(x1=-50; x1<=50; x1++) { if(!x1) continue; for(x2=-50; x2<=50; x2++) { if(!x2) continue; sum=a1*x1*x1*x1+a2*x2*x2*x2; if(sum<0) sum+=25000000; hash[sum]++; } } 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; sum=a3*x3*x3*x3+a4*x4*x4*x4+a5*x5*x5*x5; if(sum<0) sum+=25000000; ans+=hash[sum]; } } } cout<<ans<<endl; return 0; }
相关文章推荐
- HDU_1496 Equations && POJ_1840 Eqs(Hash)
- POJ题目1840 Eqs(hash)
- POJ1840: Eqs(hash问题)
- POJ 1840 Eqs [HASH]
- POJ 1840 Eqs (Hash)
- poj 1840 Eqs (Hash)
- poj 1840 Eqs , hash
- Poj 1840 Eqs(Hash)
- POJ 1840 Eqs.cpp 【 Hash 】
- POJ 1840 Eqs(hash)
- hdu 题目1496 Equations , POJ 题目1840 Eqs (整数Hash)
- poj-1840 Eqs(hash)
- HDU-1496-Equations && POJ-1840-Eqs (hash)
- POJ-1840 Eqs Hash
- POJ 1840 Eqs(简单hash入门)
- POJ 1840 Eqs(枚举+HASH)
- POJ 1840 Eqs (hash)
- [POJ 1840]Eqs[hash][枚举]
- POJ 1840 Eqs hash
- POJ 1840Eqs(hash)