| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
这题太水了。。。#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int a,b,c,d,e;
int hash[2000000];
int main()
{
scanf("%d%d%d%d%d",&a,&b,&c,&d,&e);
int cnt=0;
for(int i=-50;i<=50;i++)
{
if(i==0) continue;
for(int j=-50;j<=50;j++)
{
if(j==0) continue;
for(int k=-50;k<=50;k++)
{
if(k==0) continue;
int tmp=i*i*i*a+j*j*j*b+k*k*k*c;
hash[cnt++]=tmp;
}
}
}
sort(hash,hash+cnt);
int ans=0;
for(int i=-50;i<=50;i++)
{
if(i==0) continue;
for(int j=-50;j<=50;j++)
{
if(j==0) continue;
int tmp=i*i*i*d+j*j*j*e;
ans+=upper_bound(hash,hash+cnt,-tmp)-lower_bound(hash,hash+cnt,-tmp);
}
}
printf("%d\n",ans);
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator