题目:http://poj.org/problem?id=1840

题解:http://blog.csdn.net/lyy289065406/article/details/6647387 小优姐讲的很好了

 #include<cstdio>
#include<string>
#include<iostream>
#include<cstring>
#include<map>
using namespace std; short hash[];
int main()
{
int a1,a2,a3,a4,a5;
int x1,x2,x3,x4,x5;
int sum,ans=;
cin>>a1>>a2>>a3>>a4>>a5;
memset(hash,,sizeof(hash));
for(x1=-; x1<=; x1++)
{
if(!x1) continue;
for(x2=-; x2<=; x2++)
{
if(!x2) continue;
sum=a1*x1*x1*x1+a2*x2*x2*x2;
if(sum<)
sum+=;
hash[sum]++;
}
}
for(x3=-; x3<=; x3++)
{
if(!x3) continue;
for(x4=-; x4<=; x4++)
{
if(!x4) continue;
for(x5=-; x5<=; x5++)
{
if(!x5) continue;
sum=a3*x3*x3*x3+a4*x4*x4*x4+a5*x5*x5*x5;
if(sum<)
sum+=;
ans+=hash[sum];
}
}
}
cout<<ans<<endl; return ;
}

poj 1840 Eqs (hash)的更多相关文章

  1. POJ 1840 Eqs(乱搞)题解

    思路:这题好像以前有类似的讲过,我们把等式移一下,变成 -(a1*x1^3 + a2*x2^3)== a3*x3^3 + a4*x4^3 + a5*x5^3,那么我们只要先预处理求出左边的答案,然后再 ...

  2. 哈希(Hash)与加密(Encrypt)相关内容

    1.哈希(Hash)与加密(Encrypt)的区别 哈希(Hash)是将目标文本转换成具有相同长度的.不可逆的杂凑字符串(或叫做消息摘要),而加密(Encrypt)是将目标文本转换成具有不同长度的.可 ...

  3. POJ 2431 Expedition(探险)

    POJ 2431 Expedition(探险) Time Limit: 1000MS   Memory Limit: 65536K [Description] [题目描述] A group of co ...

  4. 数据结构之哈希(hash)表

    最近看PHP数组底层结构,用到了哈希表,所以还是老老实实回去看结构,在这里去总结一下. 1.哈希表的定义 这里先说一下哈希(hash)表的定义:哈希表是一种根据关键码去寻找值的数据映射结构,该结构通过 ...

  5. redis学习-散列表常用命令(hash)

    redis学习-散列表常用命令(hash)   hset,hmset:给指定散列表插入一个或者多个键值对 hget,hmget:获取指定散列表一个或者多个键值对的值 hgetall:获取所欲哦键值以及 ...

  6. POJ 3414 Pots(罐子)

    POJ 3414 Pots(罐子) Time Limit: 1000MS    Memory Limit: 65536K Description - 题目描述 You are given two po ...

  7. POJ 3281 Dining (网络流)

    POJ 3281 Dining (网络流) Description Cows are such finicky eaters. Each cow has a preference for certai ...

  8. POJ 1847 Tram (最短路径)

    POJ 1847 Tram (最短路径) Description Tram network in Zagreb consists of a number of intersections and ra ...

  9. 【Redis】命令学习笔记——哈希(hash)(15个超全字典版)

    本篇基于redis 4.0.11版本,学习哈希(hash)相关命令. hash 是一个string类型的field和value的映射表,特别适合用于存储对象. 序号 命令 描述 实例 返回 HSET ...

随机推荐

  1. Get vertical scrollbar width and example

    $.scrollbarWidth = function () { var parent, child, width; if (width === undefined) { parent = $('&l ...

  2. 解决未能从程序集xxx中加载类型System.ServiceModel.Activation.HttpModule的问题

    在IIS中运行网站时,出现错误: 未能从程序集“System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c ...

  3. easy ui datagrid 设置冻结列

    为了冻结列,您需要定义 frozenColumns 属性.frozenColumn 属性和 columns 属性一样. $('#tt').datagrid({ title:'Frozen Column ...

  4. 运行windows系统工具命令

    appwiz.cpl 卸载/安装程序  wscui.cpl 操作中心 inetcpl.cpl  查看Internet属性  eventvwr     查看监视消息和疑难解答消息  taskmgr  任 ...

  5. DB天气 Alpha版使用说明

    一 产品介绍 DB天气是一款能够准确预报天气的软件,它的特点在于它的简洁的设计风格,以及贴心的预报方式.是一款非主流的小清新的天气APP. 二 功能介绍 下面介绍一下DB天气的主界面以及天气功能的实现 ...

  6. Xcode 合并分支报错

    原理和操作步骤见如下转载的两篇文章, 我所使用的 svn 客户端软件是 Mac 下面的 Versions.app v1.06 这个版本包含一个多人开发的bug bug 的解决方案见我之前转载的两篇文章 ...

  7. ios实现截屏(转)

    -(UIImage*) makeImage {  UIGraphicsBeginImageContext(self.view.bounds.size);  [self.view.layer rende ...

  8. poj 2762 Going from u to v or from v to u?(强连通分量+缩点重构图+拓扑排序)

    http://poj.org/problem?id=2762 Going from u to v or from v to u? Time Limit: 2000MS   Memory Limit:  ...

  9. 1047: [HAOI2007]理想的正方形 - BZOJ

    Description 有一个a*b的整数组成的矩阵,现请你从中找出一个n*n的正方形区域,使得该区域所有数中的最大值和最小值的差最小.Input 第一行为3个整数,分别表示a,b,n的值第二行至第a ...

  10. What we learned in Seoul with AlphaGo

    What we learned in Seoul with AlphaGo March 16, 2016 Go isn’t just a game—it’s a living, breathing c ...