poj 1840 哈希~~~
来源:互联网 发布:身体乳推荐知乎 编辑:程序博客网 时间:2024/05/22 03:02
分成左右两个部分a1,a2和-a3,-a4,-a5
View Code
import java.io.*;
import java.util.*;
import java.math.*;
public class Main{
public static void main(String[] args){
Scanner cin = new Scanner (System.in);
int a1=cin.nextInt();
int a2=cin.nextInt();
int a3=cin.nextInt();
int a4=cin.nextInt();
int a5=cin.nextInt();
System.out.println(hashQuestions(a1,a2,a3,a4,a5));
}
public static int hashQuestions(int a1,int a2,int a3,int a4,int a5){
char hash[] = new char[25000010];
int bigs[] = new int[100];
int pos=0;
int m=0;
for(int x=-50;x<=50;x++){
if(x!=0) bigs[m++]=x*x*x;
}
for(int i=0;i<100;i++){
for(int j=0;j<100;j++){
pos=-(bigs[i]*a1+bigs[j]*a2);
hash[pos+12500000]++;
}
}
int ans=0;
for(int i=0;i<100;i++){
for(int j=0;j<100;j++){
for(int k=0;k<100;k++){
pos = bigs[i]*a3+bigs[j]*a4+bigs[k]*a5;
if(pos > 12500000 || pos < -12500000) continue;
ans+=hash[pos+12500000];
}
}
}
return ans;
}
}
- POJ 1840 (哈希)
- poj 1840 哈希~~~
- Eqs - POJ 1840 哈希
- poj 1840 哈希
- POJ 1840(哈希)
- Eqs poj 1840 哈希
- poj 1840 Eqs (哈希)
- POJ 1840 Eqs(哈希)
- POJ 1840 Eqs(哈希)
- poj-1840 Eqs 暴力+哈希
- poj 1840 哈希+离散化
- poj 1840 Eqs(哈希)
- POJ 1840 Eqs (哈希)
- POJ 1840 Eqs(模拟+哈希)
- POJ 1840
- POJ 1840
- POJ 1840
- POJ 1840
- 线段树 单点更新 【第一节】
- hdu 4152 dfs 枚举
- poj 2187 求平面最远点对 快速凸包 旋转卡壳
- poj 3982 高精度java
- poj 2230 欧拉回路
- poj 1840 哈希~~~
- ural 1088 二叉树基本性质
- 树状数组从前往后求和,用来解第k大(或小)的数 poj 2985 The k-th Largest Group
- poj 2985 线段树求第k大的数
- 线段树 树状数组 求大于某个值的第k小的数 hdu 2852 KiKi's K-Number
- 线段树【第二小节】
- Stanford Machine Learning -- 第四讲 Machine Learning System design
- hdu 3564 树状数组的灵活应用
- hdu 1166 树状数组简单题