HDU 1017 A Mathematical Curiosity【水,坑】
A Mathematical Curiosity
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 41995 Accepted Submission(s): 13502
two integers n and m, count the number of pairs of integers (a,b) such
that 0 < a < b < n and (a^2+b^2 +m)/(ab) is an integer.
This problem contains multiple test cases!
The
first line of a multiple input is an integer N, then a blank line
followed by N input blocks. Each input block is in the format indicated
in the problem description. There is a blank line between input blocks.
The output format consists of N output blocks. There is a blank line between output blocks.
will be given a number of cases in the input. Each case is specified by
a line containing the integers n and m. The end of input is indicated
by a case in which n = m = 0. You may assume that 0 < n <= 100.
each case, print the case number as well as the number of pairs (a,b)
satisfying the given property. Print the output for each case on one
line in the format as shown below.
1 10 1
20 3
30 4
0 0
Case 1: 2
Case 2: 4
Case 3: 5
#include <bits/stdc++.h>
using namespace std;
int n,m;
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int k=;
while(scanf("%d%d",&n,&m)&&n||m)
{
int ans=;
for(int i=;i<n;i++)
{
for(int j=i+;j<n;j++)
{
if((i*i+j*j+m)%(i*j)==)
ans++;
}
}
printf("Case %d: %d\n",k++,ans);
}
if(t)
printf("\n");
}
return ;
}
HDU 1017 A Mathematical Curiosity【水,坑】的更多相关文章
- HDU 1017 A Mathematical Curiosity (数学)
A Mathematical Curiosity Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java ...
- HDU 1017 A Mathematical Curiosity【看懂题意+穷举法】
//2014.10.17 01:19 //题意: //先输入一个数N,然后分块输入,每块输入每次2个数,n,m,直到n,m同一时候为零时 //结束,当a和b满足题目要求时那么这对a和b就是一组 ...
- HDU 1017 A Mathematical Curiosity (枚举水题)
Problem Description Given two integers n and m, count the number of pairs of integers (a,b) such tha ...
- HDU 1017 A Mathematical Curiosity (输出格式,穷举)
#include<stdio.h> int main() { int N; int n,m; int a,b; int cas; scanf("%d",&N); ...
- HDU 1017 - A Mathematical Curiosity
题目简单,格式酸爽.. #include <iostream> using namespace std; int ans,n,m,p; int main() { cin>>p; ...
- HDU 1017 A Mathematical Curiosity(枚举)
题目链接 Problem Description Given two integers n and m, count the number of pairs of integers (a,b) suc ...
- 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. ...
- Hdu oj 1017 A Mathematical Curiosity
题目:pid=1017">点击打开链接 #include<stdio.h> int main() { int t; scanf("%d",&t) ...
- HDOJ 1017 A Mathematical Curiosity
Problem Description Given two integers n and m, count the number of pairs of integers (a,b) such tha ...
随机推荐
- Robotframework-Appium系列:登录操作
之前Appium的环境已经配置完成(参考Robotframework-Appium系列:安装配置),接下来就是如何使用Appium来完成我们的apk的测试工作. 一.环境准备 所需的软件列表如下 Ro ...
- Hosts文件实际应用 配置内部服务器提高访问效率和速度
一 hosts文件的作用和介绍 https://jingyan.baidu.com/article/335530da45485e19cb41c3d6.html https://www.cnblogs. ...
- Spring之DAO一
前面博客把bean.aop简单了解了一下,今天主要是了解Spring中DAO层,如果使用传统的JDBC时需要创建连接.打开.执行sql.关闭连接这一系列的步骤,Spring框架对JDBC进行了封装,我 ...
- 浅析Node.js的Event Loop
目录 浅析Node.js的Event Loop 引出问题 Node.js的基本架构 Libuv Event Loop Event Loop Phases Overview Poll Phase The ...
- 原生JavaScript实现一个简单的todo-list
直接上代码: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UT ...
- (一)初识mybatis
Mybatis 是现在很多公司都选择使用的一个ORM(Object Relational Mapping)框架,所以是值得了解和学习一番的. MyBatis 是支持定制化 SQL.存储过程以及高级映射 ...
- avro 1.8.2 (js)
5月15日发布的avro 1.8.2 已经包含了js版代码. 清华大学镜像地址: https://mirrors.tuna.tsinghua.edu.cn/apache/avro/avro-1.8.2 ...
- Linux(CentOS6.5)下编译安装Nginx1.10.1
首先在特权账号(root)下安装编译时依赖项: yum install gcc gcc-c++ perl -y 首先以非特权账号(本文以账号comex为例)登陆OS: 进入data目录下载相关安装 ...
- touch监听判断手指的上滑,下滑,左滑,右滑,事件监听
判断滑动的方向和距离,来实现一定的效果,比如返回上一页等等 <body> <script> $(function(){ //给body强制定义高度 var windowHeig ...
- 我 对jvm 创建线程的一些了解
1.jvm 每创建一个线程都会对应产生一个该线程的虚拟机栈,栈大小通过-Xss参数来设置,JDK1.5之后默认为1M 2.JVM创建线程需要内存,但这部分内存不使用堆内存(毕竟JVM虚拟机栈).对于3 ...