Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

hash(代码)

Posted by louchiheng at 2016-04-24 18:31:57 on Problem 1840
#include<iostream>
#include<cstdio>
#include<string.h>
#include<algorithm>
#include<cmath>
using namespace std;
const int maxn=12500000;
struct snow
{
	int a[5];
}x;
short a[maxn*2+1];
int n,i,j,k,sum,tot=0;
int main()
{
    for(i=0;i<5;++i)scanf("%d",&x.a[i]);
    for(i=-50;i<=50;++i)
    if(i!=0)for(j=-50;j<=50;++j)
    if(j!=0)a[i*i*i*x.a[0]+j*j*j*x.a[1]+maxn]++;
    for(i=-50;i<=50;++i)
    if(i!=0)for(j=-50;j<=50;++j)
    if(j!=0)for(k=-50;k<=50;++k)
    if(k!=0)
    {
    	sum=i*i*i*x.a[2]+j*j*j*x.a[3]+k*k*k*x.a[4];
    	if(sum<=12500000&&sum>=-12500000)
    	tot+=a[sum+maxn];
	}
	printf("%d\n",tot);
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator