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

哈神马希。。。直接开出31250000*2的数组就能过。。还贼快,只不过要开short的,估计是数据不强,哈哈

Posted by zhaocong89 at 2011-04-11 20:32:54 on Problem 1840
/*
 * 3.cpp
 *
 *  Created on: 2011-4-11
 *      Author: zcoder
 */
#if 1
#include <iostream>
#include <fstream>
#include <cstring>
#include <cstdlib>
#include <cstdio>
using namespace std;
#define MAXHASHSIZE 31250010
short head[MAXHASHSIZE*2];
int main(){
#ifndef ONLINE_JUDGE
	freopen("test.in","r",stdin);
#endif
	int a,b,c,d,e,x1,x2,x3,x4,x5;
	long long res = 0;
	scanf("%d%d%d%d%d",&a,&b,&c,&d,&e);
	for(x4=-50;x4<=50;x4++){
		for(x5=-50;x5<=50;x5++){
			if(x4!=0&&x5!=0){
				int tmp = d*x4*x4*x4+e*x5*x5*x5+MAXHASHSIZE;
				head[tmp] ++;
			}
		}
	}
	for(x1=-50;x1<=50;x1++){
		for(x2=-50;x2<=50;x2++){
			for(x3=-50;x3<=50;x3++){
				if(x1!=0&&x2!=0&&x3!=0){
					int tmp = -(a*x1*x1*x1+b*x2*x2*x2+c*x3*x3*x3)+MAXHASHSIZE;
						res += head[tmp];
				}
			}
		}
	}
	cout<<res<<endl;
	return 0;
}
#endif

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