HDU 1017 直接暴力。
Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u
Description
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.
Input
Output
Sample Input
1 10 1
20 3
30 4
0 0
Sample Output
Case 1: 2
Case 2: 4
Case 3: 5 代码:
#include<stdio.h>
#include<string.h>
#include<math.h> #define N 110 int main()
{
int i, j, t, n, m, f = 0; scanf("%d", &t); while(t--)
{
int k = 1; if(f == 1)
printf("\n"); while(scanf("%d%d", &n, &m), n+m)
{
int ans=0; for(i = 1; i < n; i++)
{
for(j = 1; j < n; j++)
{
if((i*i+j*j+m) % (i*j) == 0 && (i < j))
ans++;
} }
printf("Case %d: %d\n", k++,ans);
} f = 1;
}
return 0;
}
HDU 1017 直接暴力。的更多相关文章
- 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
题目简单,格式酸爽.. #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(** **)
题意是给定 n,m,问有多少组(a,b)满足 0 < a < b < n 而且 (a ^ 2 + b ^ 2 + m) / ( a * b ) 是整数. 直接模拟即可. 代码如下: ...
- 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 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 (输出格式,穷举)
#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 1017 A Mathematical Curiosity【看懂题意+穷举法】
//2014.10.17 01:19 //题意: //先输入一个数N,然后分块输入,每块输入每次2个数,n,m,直到n,m同一时候为零时 //结束,当a和b满足题目要求时那么这对a和b就是一组 ...
随机推荐
- swagger生成错误问题 汇总解决
Unable to render this definition The provided definition does not specify a valid version field. Ple ...
- numpy初识 old
一.创建ndarrary 1.使用np.arrary()创建 1).一维数组 import numpy as np np.array([1, 2, 3, 4]) 2).二维数组 np.array([[ ...
- python property()函数:定义属性
正常情况下,类包含的属性应该是隐藏的,只允许通过类提供的方法来间接的实现对类属性的访问和操作. class Person: #构造函数 def __init__(self, name): self.n ...
- cocos2dx,Layer锚点与scale缩放
最近写代码需要用到缩放,而且是Layer的,但是发现怎么设置位置都是错误,于是决定研究下. 首先,基础代码,代码上不错特殊处理,没有锚点设置和缩放 class TestLayer : public L ...
- 机器学习环境配置系列二之cuDNN
1.下载cuDNN 前往: NVIDIA cuDNN home page. 进入下载 勾选Nvidia的协议复选框(流氓的选择,不勾选不能下载) 选择与安装的cuda版本一致的cudnn进行下载. 2 ...
- axios请求方法封装.
axios的使用上一般封装好对应的方法,ES6导出,直接调用,消息通知使用了ElementUI的Message组件. 这是一个封装了axios的Rest风格的工具类,包扩常用的POST,GET,PUT ...
- rabbitmq使用总结
rabbitmq 架构图 RabbitMQ 中的 broker 是指什么?cluster 又是指什么 broker 是指一个或多个 erlang node 的逻辑分组,且 node 上运行着 Rabb ...
- UML类图的情话诉说
你知道吗这个世界是个繁杂而又简单的世界 你我在冥冥中都有联系 有时候,你像我的妈妈一样,对你依赖满满, 没有你我不知道何去何从(依赖) 有时候,看你,真如我亲爱孩子般,想一直拥你入我怀抱,但我知道终究 ...
- Leetcode 题目整理 climbing stairs
You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb ...
- JVM源码分析之警惕存在内存泄漏风险的FinalReference(增强版)
概述 JAVA对象引用体系除了强引用之外,出于对性能.可扩展性等方面考虑还特地实现了四种其他引用:SoftReference.WeakReference.PhantomReference.FinalR ...