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。
简单的数学题,要注意的就是格式,这题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 数学题的更多相关文章
- 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 (数学)
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
题目简单,格式酸爽.. #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 (输出格式,穷举)
#include<stdio.h> int main() { int N; int n,m; int a,b; int cas; scanf("%d",&N); ...
- 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 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 ...
随机推荐
- API的HTTP Status Code
响应中的状态码 状态码 定义 说明 1xx 信息 接收到请求,继续处理 2xx 成功 操作成功地收到请求,理解和接受 3xx 重定向 为了完成请求,必须采取进一步擦措施 4xx 客户端错误 请求的语法 ...
- PHP 中各种命名规则的总结
一般约定而言 类.函数和变量的名字应该是能够让代码阅读者能够容易地知道这些代码的作用,应该避免使用凌磨两可的命名. 以下是在开发过程中常见的命名规则总结 1.类的命名 使用大写字母作为词的分割,其余的 ...
- Python批量文件重命名
今天,得到一个里面都是图片的文件夹,但是图片都没有后缀,因此想用Pythton批量地为所有的文件加上".jpg"的后缀,代码如下: #-*- coding:utf-8 -*- #重 ...
- A Shade of Moonlight CodeForces - 989D
看这位博主的吧:https://blog.csdn.net/Steaunk/article/details/80660954
- python中使用%与.format格式化文本
初学python,看来零零碎碎的格式化文本的方法,总结一下python中格式化文本的方法.使用不当的地欢迎指出谢谢. 1.首先看使用%格式化文本 常见的占位符: 常见的占位符有: %d 整数 %f 浮 ...
- 【BZOJ 1098】办公楼(补图连通块个数,Bfs)
补图连通块个数这大概是一个套路吧,我之前没有见到过,想了好久都没有想出来QaQ 事实上这个做法本身就是一个朴素算法,但进行巧妙的实现,就可以分析出它的上界不会超过 $O(n + m)$. 接下来介绍一 ...
- 【spoj SUBLEX】 Lexicographical Substring Search
http://www.spoj.com/problems/SUBLEX/ (题目链接) 题意 给出一个字符串,询问其中字典序第K小的子串. Solution 后缀自动机例题. 构出后缀自动机以后,对每 ...
- 多项式 Wannafly挑战赛22
后缀表达式 大整数(加法.乘法.gcd java) import java.math.BigInteger; import java.util.Scanner; class Work { String ...
- 【Asp.net入门4-01】基本开发工具
- vue全局组件和局部组件
1.全局注册组件 Vue.componet('name',{ template:'<div></div>', data(){ retrun {} } }) 使用了以上这种方式注 ...