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. Android的理解

    从组件的角度来考虑 Activity------------------Service-----------------Broadcast Receiver---------------------- ...

  2. Qt之QTableView显示富文本(使用了QAbstractTextDocumentLayout和QTextDocument)

    http://blog.csdn.net/liang19890820/article/details/50973099

  3. 在VC中检测内存泄漏

    声明:checkleaks.h和checkleaks.cpp这两个文件中的代码是在网上COPY的,但原来那个网站现在却找不到了 所以,这篇文章不算完全原创,呵呵. 就当作是一个存档吧 先上代码: // ...

  4. 【HDOJ】1224 Free DIY Tour

    DP. #include <cstdio> #include <cstring> #include <cstdlib> #include <algorithm ...

  5. HDU_2044——蜜蜂走蜂房,递推

    Problem Description 有一只经过训练的蜜蜂只能爬向右侧相邻的蜂房,不能反向爬行.请编程计算蜜蜂从蜂房a爬到蜂房b的可能路线数. 其中,蜂房的结构如下所示.   Input 输入数据的 ...

  6. CSS(三)

    CSS又上完了,真是快!!! 预习了JS的一部分,写了几条简单的JS代码: 1.成绩判定: <!DOCTYPE html> <html lang="en"> ...

  7. Grails教程

    1简介- Reference DocumentationVersion:null Table of Contents 1.1Grails 2.0有那些新特性?1.1.1面向开发的特性1.1.2核心特性 ...

  8. EBuild-API常见问题汇总

    问题1:用户访问被防火墙屏蔽检查处理流程 E-Build API(原IBE)是面向航空公司和代理人,以及第三方的航空预订服务产品.用户通过客户端,使用固定IP访问E-Build API服务器,航信网络 ...

  9. 【winform程序】自定义webrowser控件调用IE的版本

    修改注册表: bit: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROW ...

  10. 解决从github下载web的源代码部署到eclipse的问题

    2015年6月2日 天气晴 github官网:https://github.com/ 以下以pdf.js作为案例说明:https://github.com/mozilla/pdf.js 1).点击案例 ...