Description:

Consider equations having the following form: a*x1*x1 + b*x2*x2 + c*x3*x3 + d*x4*x4 = 0 a, b, c, d are integers from the interval [-50,50] and any of them cannot be 0. It is consider a solution a system ( x1,x2,x3,x4 ) that verifies the equation, xi is an integer from [-100,100] and xi != 0, any i ∈{1,2,3,4}. Determine how many solutions satisfy the given equation.

Input:

The input consists of several test cases. Each test case consists of a single line containing the 4 coefficients a, b, c, d, separated by one or more blanks.

Output:

or each test case, output a single line containing the number of the solutions.

Sample Input:

1 2 3 -4
1 1 1 1
 
 
39088
0
 
 

#include<stdio.h>
#include<string.h>
int hash1[] = { }, hash2[] = { };
int main()
{
int a, b, c, d, sum;
while (scanf("%d%d%d%d", &a, &b, &c, &d) != EOF)
{
int i, j, s;
memset(hash1, , sizeof(hash1));
memset(hash2, , sizeof(hash2));
if ((a> && b> && c> && d>) || (a< && b< && c< && d<))
{
printf("0\n");
continue;
}
else
{
for (i = ; i <= ; i++)
{
for (j = ; j <= ; j++)
{
s = a*i*i + b*j*j;
if (s >= )hash1[s]++;
else hash2[-s]++;
}
}
sum = ;
for (i = ; i <= ; i++)
{
for (j = ; j <= ; j++)
{
s = c*i*i + d*j*j;
if (s>)sum += hash2[s];
else sum += hash1[-s];
}
}
printf("%d\n", sum * );
}
}
return ;
}

程序设计C 实验三 题目九 方程式(0300)的更多相关文章

  1. 20145213《Java程序设计》实验三敏捷开发与XP实践

    20145213<Java程序设计>实验三敏捷开发与XP实践 实验要求 1.XP基础 2.XP核心实践 3.相关工具 实验内容 1.敏捷开发与XP 软件工程是把系统的.有序的.可量化的方法 ...

  2. 2018-2019-2 20175227张雪莹《Java程序设计》实验三 《敏捷开发与XP实践》

    2018-2019-2 20175227张雪莹<Java程序设计> 实验三 <敏捷开发与XP实践> 实验报告封面 课程:Java程序设计 班级:1752班 姓名:张雪莹 学号: ...

  3. 20145206《Java程序设计》实验三实验报告

    20145206<Java程序设计>实验三实验报告 实验内容 XP基础 XP核心实践 相关工具 实验步骤 (一)敏捷开发与XP 软件工程是把系统的.有序的.可量化的方法应用到软件的开发.运 ...

  4. 20145308刘昊阳 《Java程序设计》实验三 敏捷开发与XP实践 实验报告

    20145308刘昊阳 <Java程序设计>实验三 敏捷开发与XP实践 实验报告 实验名称 敏捷开发与XP实践 实验内容 XP基础 XP核心实践 相关工具 统计的PSP(Personal ...

  5. 20145225《Java程序设计》 实验三 "敏捷开发与XP实践"

    20145225<Java程序设计> 实验三 "敏捷开发与XP实践" 实验报告 实验内容 使用 git 上传代码 使用 git 相互更改代码 实现代码的重载 git 上 ...

  6. 20145302张薇《Java程序设计》实验三报告

    20145302张薇<Java程序设计>实验三:敏捷开发与XP实践 实验内容 使用git上传代码 使用git实现代码开发实践 实现代码的重载 使用git上传代码 git init git ...

  7. 20145120 《Java程序设计》实验三实验报告

    20145120 <Java程序设计>实验三实验报告 实验名称:敏捷开发与XP实践 实验目的与要求: XP基础 XP核心实践 相关工具 (一)敏捷开发与XP 极限编程(eXtreme Pr ...

  8. 20155324 《Java程序设计》实验三 敏捷开发与XP实践

    20155324 <Java程序设计>实验三 敏捷开发与XP实践 实验内容 XP基础 1.XP核心实践 2.相关工具 实验步骤 敏捷开发与XP 1.敏捷开发(Agile Developme ...

  9. 20165205 2017-2018-2 《Java程序设计》实验三 敏捷开发与XP实践

    20165205 2017-2018-2 <Java程序设计>实验三 敏捷开发与XP实践 实验内容 检查点1: 安装alibaba 插件,解决代码中的规范问题 首先把搭档加入到自己的项目中 ...

随机推荐

  1. 转:AM335X 启动流程

    链接: http://blog.csdn.net/hudaweikevin/article/details/10376585  作者:David_Hu 启动顺序(针对TI OMA3 EVM) linu ...

  2. 模糊集合和隶属度函数--AForge.NET框架的使用(一)

    原文:模糊集合和隶属度函数--AForge.NET框架的使用(一) 什么是AForge.NET? AForge.NET是一个为开发人员和研究人员开发的框架,它可以用于计算机视觉,遗传算法,图像处理,神 ...

  3. BZOJ1697: [Usaco2007 Feb]Cow Sorting牛排序

    1697: [Usaco2007 Feb]Cow Sorting牛排序 Time Limit: 5 Sec  Memory Limit: 64 MBSubmit: 387  Solved: 215[S ...

  4. ACM2114_S[I](1^3+2^3+3^3)

    #include<iostream> using namespace std; int main() { __int64 n,m,i,j,sum; while(cin>>n) ...

  5. 移动web app开发框架

    文章地址:http://www.cnblogs.com/soulaz/p/5586787.html jQuery Mobile jQuery Mobile框架能够帮助你快速开发出支持多种移动设备的Mo ...

  6. Best Time to Buy and Sell Stock IV 解答

    Question Say you have an array for which the ith element is the price of a given stock on day i. Des ...

  7. css样式-表格优化

    1.表格的初步优化 index.html <!DOCTYPE html> <html> <head> <meta charset="UTF-8&qu ...

  8. pic_for_youdao

  9. Codeforces Round #256 (Div. 2/B)/Codeforces448B_Suffix Structures(字符串处理)

    解题报告 四种情况相应以下四组数据. 给两字符串,推断第一个字符串是怎么变到第二个字符串. automaton 去掉随意字符后成功转换 array 改变随意两字符后成功转换 再者是两个都有和两个都没有 ...

  10. event.getAction()&MotionEvent.ACTION_MASK的原因

    看到下面代码中用了AND位运算是为了什么呢? public boolean onTouchEvent(MotionEvent event) { int action = event.getAction ...