题目链接

/*
Name:
Copyright:
Author:
Date: 2018/5/3 16:32:15
Description:
*/
#include <iostream>
#include <cstdio>
using namespace std;
int n, m;
bool equals(int a, int b) {
if ((a*a+b*b+m) % (a*b) == )return true;
return false;
}
int main()
{
int t;
cin>>t;
while (t--) {
int tag = ;
while (cin>>n>>m) {
if ((n+m) == ) break;
int ct = ;
for (int i=; i<n; i++) {
for (int j=i+; j<n; j++) {
if (i == j) continue;
if (equals(i, j)) {
ct++;
}
}
}
printf("Case %d: %d\n", ++tag, ct);
}
if (t >= ) printf("\n");//换行
}
return ;
}

hdoj-1017-A Mathematical Curiosity(格式坑)的更多相关文章

  1. HDOJ 1017 A Mathematical Curiosity

    Problem Description Given two integers n and m, count the number of pairs of integers (a,b) such tha ...

  2. HDU 1017 A Mathematical Curiosity【水,坑】

    A Mathematical Curiosity Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java ...

  3. HDU 1017 A Mathematical Curiosity (数学)

    A Mathematical Curiosity Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java ...

  4. HDU 1017 A Mathematical Curiosity【看懂题意+穷举法】

    //2014.10.17    01:19 //题意: //先输入一个数N,然后分块输入,每块输入每次2个数,n,m,直到n,m同一时候为零时  //结束,当a和b满足题目要求时那么这对a和b就是一组 ...

  5. Hdu oj 1017 A Mathematical Curiosity

    题目:pid=1017">点击打开链接 #include<stdio.h> int main() { int t; scanf("%d",&t) ...

  6. HDU 1017 - A Mathematical Curiosity

    题目简单,格式酸爽.. #include <iostream> using namespace std; int ans,n,m,p; int main() { cin>>p; ...

  7. HDU 1017 A Mathematical Curiosity 数学题

    解题报告:输入两个数,n和m,求两个数a和b满足0<a<b<n,并且(a^2+b^2+m) % (a*b) =0,这样的a和b一共有多少对.注意这里的b<n,并不可以等于n. ...

  8. HDU 1017 A Mathematical Curiosity (输出格式,穷举)

    #include<stdio.h> int main() { int N; int n,m; int a,b; int cas; scanf("%d",&N); ...

  9. HDU 1017 A Mathematical Curiosity (枚举水题)

    Problem Description Given two integers n and m, count the number of pairs of integers (a,b) such tha ...

随机推荐

  1. html用a标签怎么提交表单

    如下代码请 帮忙完善function judgeDelete()   {     if(confirm("确定要删除吗?"))     {      window.location ...

  2. ajax发送js类型的数据

    一.如图所示 var ids = [1,2,3,4,5,6,7] $.ajax({ url: requestUrl, type: 'delete', data: JSON.stringify(ids) ...

  3. Python操作——Memcached

    Memcached是一个高性能的分布式内存对象缓存系统,用于Web应用以减轻数据库的负载. 它通过在内存中缓存数据和对象来减少读取数据库的次数,从而提高动态.数据库驱动网站的速度. Memcached ...

  4. Java字段初始化规律:

    Java字段初始化规律: Java进行初始化的地方有两个,初始化块和构造函数,其中初始化块又分为静态初始化块和实例初始化块(以上程序为实例初始化块).静态初始化块是类中由static修饰的初始化块,实 ...

  5. 主攻ASP.NET.4.5.1 MVC5.0之重生:Web项目语音朗读网页文本,简单语音提示浏览状态

    第一步 添加SpeechLib.dll 下载SpeechLib.dll: 在项目中并且引用DLL using SpeechLib; using System.Threading; 第二步 调用并使用 ...

  6. webstrom上运行node项目配置操作

    其实特别简单.... 去webtrom主界面找到下图的按钮,点击 点击之后弹框如下: 点击左上方绿色加号,如下图,点击node.js 点击之后,填写下图中内容: 点击应用,主界面的绿色开始按钮就可以用 ...

  7. INSPIRED启示录 读书笔记 - 第4章 产品管理与产品设计

    理解用户体验设计 1.用户研究:专门研究.分析用户,评估产品或产品原型是否符合特定用户的使用习惯.其具体工作包括拟订恰当的测试项目,监督测试,评估测试结果,提出改进方案 2.交互设计:在理解目标用户的 ...

  8. JAVA基础补漏--字符串

    字符串常量池 String a="abc"; String b="abc"; char[] str = {"a","b" ...

  9. Spark- 共享变量

    Shared Variables Normally, when a function passed to a Spark operation (such as map or reduce) is ex ...

  10. 1、html(),text(),value()的区别;2、remove() 3、加载完执行函数

    1 .html()用为读取和修改元素的HTML标签.2  .text()用来读取或修改元素的纯文本内容.3  .val()用来读取或修改表单元素的value值. 这三个方法功能上的对比 .html() ...