hdu 1496
来源:互联网 发布:php自动发卡平台 编辑:程序博客网 时间:2024/06/05 17:50
//最简单的hash
#include<iostream>using namespace std;int a, b, c, d;int x1, x2, x3, x4;int f1[1000005];int f2[1000005];int main(){while(cin >> a >> b >> c >> d){if( a > 0 && b > 0 && c > 0 && d > 0){cout<<0<<endl;continue;} if( a < 0 && b < 0 && c < 0 && d < 0){cout<<0<<endl;continue;} for(int i = 0; i < 1000005; i ++) f1[i] = 0;for(int j = 0; j < 1000005; j ++) f2[j] = 0; int ans = 0;int s;for(int i = 1; i <= 100; i ++){x1 = i;for(int j = 1; j <= 100; j ++){x2 = j;s = a * x1 * x1 + b * x2 * x2;if(s >= 0) f1[s] ++; // s等于0的给f1 else f2[-s] ++; }}for(int i = 1; i <= 100; i ++){x3 = i;for(int j = 1; j <= 100; j ++){x4 = j;s = c * x3 * x3 + d * x4 * x4;if(s > 0) ans += f2[s]; // 所以这边是s>0而不是s>=0了 else ans += f1[-s];}}cout<<ans*16<<endl;}return 0;}
0 0
- hdu 1496
- hdu 1496
- HDU 1496
- hdu 1496
- hdu 1496 hdoj 1496
- HDU 1496 哈希表实现
- hdu 1496 -- Equations(哈希)
- HDU 1496 Equations (hash)
- hdu-1496(hash)
- HDU 1496 Equations
- hdu 1496 哈希
- HDU 1496 Equations
- hdu 1496 Equations 数论
- hdu 1496 Equations
- HDU 1496 Equations (hash)
- hdu 1496 -- Equations
- hdu 1496 hash
- hdu 1496 Equations
- java.io.Serializable接口实现序列化
- Matlab 文件操作
- 谁说技术男没有人文情怀:当旅途遇到生命赞歌
- top 10 SMT paper
- 统治世界的十大算法
- hdu 1496
- leetcode-Gas Station
- 工作日志 6/2/2014 - SQL的stored procedure
- IOS开发计算文本尺寸
- php动态加载模块的时候出现PHP_FE_END’未声明(不在函数内) -----{error: ‘PHP_FE_END’ undeclared here (not in a function)}
- DSP 中的基础算法和模型的详细解析
- 16进制和字符串(包括中文)的转换
- python简单习题系列4
- C++ Primer笔记2_四种类型转换_异常机制