标签:des style http color os io strong 数据
| Time Limit: 5000MS | Memory Limit: 65536K | |
| Total Submissions: 12220 | Accepted: 5968 |
Description
Input
Output
Sample Input
37 29 41 43 47
Sample Output
654
Source
#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
const int maxn=25000000+10;
short hash[maxn];
int a1,a2,a3,a4,a5;
int main()
{
int ans,temp;
while(~scanf("%d%d%d%d%d",&a1,&a2,&a3,&a4,&a5))
{
ans=0;
memset(hash,0,sizeof(hash));
for(int i=-50;i<=50;i++)
for(int j=-50;j<=50;j++)
{
if(i==0||j==0) continue;
temp=(a1*i*i*i+a2*j*j*j)*(-1);
if(temp<0)
temp=temp+maxn;
hash[temp]++;
}
for(int i=-50;i<=50;i++)
for(int j=-50;j<=50;j++)
for(int k=-50;k<=50;k++)
{
if(i==0||j==0||k==0) continue;
temp=a3*i*i*i+a4*j*j*j+a5*k*k*k;
if(temp<0)
temp=temp+maxn;
if(hash[temp])
ans=ans+hash[temp];
}
printf("%d\n",ans);
}
return 0;
}
poj1840Eqs(哈希判重),布布扣,bubuko.com
标签:des style http color os io strong 数据
原文地址:http://blog.csdn.net/u014303647/article/details/38701587