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. spark1.1.0源码阅读-dagscheduler and stage

    1. rdd action ->sparkContext.runJob->dagscheduler.runJob def runJob[T, U: ClassTag]( rdd: RDD[ ...

  2. Android 读取和保存文件(手机内置存储器)

    1:activity_main.xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/androi ...

  3. 使用Mono Runtime Bundle制作安装包让C#桌面应用程序脱离net framework

    在Xamain 未被收购之前,这货monodroid.exe  就是一个打包的绑定...无奈 配置环境复杂,未能实现 ...有mono运行时就行了..不折腾了 玛德 让C#程序独立运行(脱离 .NET ...

  4. Android 的开源电话/通讯/IM聊天项目全集

    一.Android的XMPP客户端 Beem Beem 是一个运行于 Android 手机平台的 XMPP (jabber) 的客户端软件,兼容标准的 XMPP 服务器和服务,例如 Ejabberd, ...

  5. Sum

    Problem Description XXX is puzzled with the question below: 1, 2, 3, ..., n (1<=n<=400000) are ...

  6. POJ_3009——冰球,IDS迭代加深搜索

    Description On Planet MM-21, after their Olympic games this year, curling is getting popular. But th ...

  7. ubuntu配置bridge网桥

    先安装uml-utilities,该工具包含建立虚拟网络设备(所谓的“TAP interfaces”)的工具: sudo apt-get install uml-utilities 安装 桥接工具 b ...

  8. eclipse 编码设置

    eclipse 编码设置 浏览:2840 | 更新:2013-12-31 10:07 一般Java文件编码格式是UTF-8的.以下以默认GBK改为UTF-8为例. 1.改变整个工作空间的编码格式,这样 ...

  9. hdu 1331 Function Run Fun

    Problem Description We all love recursion! Don't we? Consider a three-parameter recursive function w ...

  10. Jetty监控线程使用情况的配置

    Jetty监控线程使用情况配置 第一步,配置xml文件 jetty-monitor.xml 参数说明: threads: 线程池中的线程 busyThreads: 使用中的线程 idleThreads ...