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

简单的数学题,要注意的就是格式,这题TM描述的真烂,注意每组测试数据之后有一个空行,但最后一组测试数据之后没有空行。

 #include<cstdio>
int main()
{
int T,n,m;
scanf("%d",&T);
while(T--)
{
int f = ;
while(scanf("%d%d",&n,&m),n+m)
{
int tot = ;
for(int i = ;i<n;++i)
for(int j = i+;j<n;++j)
if((i*i + j*j + m) % (i*j) == )
tot++;
printf("Case %d: %d\n",f++,tot);
}
if(T)
puts("");
}
return ;
}

HDU 1017 A Mathematical Curiosity 数学题的更多相关文章

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

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

  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【看懂题意+穷举法】

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

  4. HDU 1017 - A Mathematical Curiosity

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

  5. HDU 1017 A Mathematical Curiosity(枚举)

    题目链接 Problem Description Given two integers n and m, count the number of pairs of integers (a,b) suc ...

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

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

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

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

  8. Hdu oj 1017 A Mathematical Curiosity

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

  9. HDOJ 1017 A Mathematical Curiosity

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

随机推荐

  1. 简易版本vue的实现和注解

    本文参考的是前辈的简易版本Vue实现:http://www.cnblogs.com/canfoo/p/6891868.html,感谢.前辈GitHub地址:https://github.com/can ...

  2. Delphi CreateMutex 防止程序多次运行

    windows是个多用户多任务的操作系统,支持多个程序同时运行,如果你的程序不想让用户同时运行一个以上, 那应该怎样做呢? 本文将介绍避免用户同时运行多个程序的例子. 需要用到的函数CreateMut ...

  3. teamcity和jmeter结合进行接口自动化测试

    (1)从teamcity官网下载jmeter插件:https://teamcity.jetbrains.com/repository/download/TeamCityPluginsByJetBrai ...

  4. build.xml

    下载ant 解压ant 后设置ANT_HOME, PATH中添加ANT_HOME目录下的bin目录(如:ANT_HOME:,PATH:D:\apache-ant-1.9.2%ANT_HOME%\bin ...

  5. utf-8编码的中文看成2个字符,其他数字字符看成一个字符

    方法一:使用正则表达式,代码如下: function getByteLen(val) {            var len = 0;            for (var i = 0; i &l ...

  6. Sysprep错误一则

    准备搭建一台基于Windows2008的域控,通过ISO文件装完系统后,照例使用Windows Update打全了补丁.同时,考虑到经常使用Powershell,所以手动再装上了PS5.1 .因为准备 ...

  7. centos 升级内核(编译安装)

    yum install -y wget gcc gc bc gd make perl ncurses-devel xz下载地址:https://www.kernel.org#tar -Jxvf lin ...

  8. HDU 2255 奔小康赚大钱 (KM算法 模板题)

    奔小康赚大钱 Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Subm ...

  9. 字符串使用replaceAll()方法报异常

    对字符串使用replaceAll()方法替换 * ? + / | 等字符的时候会报以下异常 Dangling meta character '*' near index 0 这主要是因为这些符号在正则 ...

  10. 【刷题】洛谷 P1115 最大子段和

    题目描述 给出一段序列,选出其中连续且非空的一段使得这段和最大. 输入输出格式 输入格式: 输入文件maxsum1.in的第一行是一个正整数N,表示了序列的长度. 第2行包含N个绝对值不大于10000 ...