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就是一组 ...
随机推荐
- NumPy排序
numpy.sort()函数 该函数提供了多种排序功能,支持归并排序,堆排序,快速排序等多种排序算法 使用numpy.sort()方法的格式为: numpy.sort(a,axis,kind,orde ...
- Scrapy解析器xpath
一.使用xpath 不在scrapy框架中通过response from scrapy.http import HtmlResponse HtmlResponse->TextResponse-& ...
- RabbitMQ入门(三)订阅模式
在之前的文章RabbitMQ入门(二)工作队列中,我们创建了一个工作队列.工作队列背后的假设是每一项任务都被准确地传送至一个worker.在本文中,我们将会做一些不同的事情--我们将会把一个消息发 ...
- 「 扫盲 」Web服务器和应用服务器的区别
我们经常使用apache,tomcat,nginx,jetty等服务器,但并不清楚它们间的区别,它们中,哪些是Web服务器,哪些是应用服务器?今天就来告诉你 Web服务器 理解WEB服务器,首先你要理 ...
- FluentData -Micro ORM with a fluent API that makes it simple to query a database
Code samples Create and initialize a DbContextThe connection string on the DbContext class can be in ...
- OpenCV在Mac下的部署 Java-IntelliJ IDEA
目录 Xcode Command Line Xcode的证书许可 MacPorts的安装 环境变量的配置 安装OpenCV 安装确认 Idea配置 额外可能产生的问题 Xcode Command Li ...
- RainbowPlan-Alpha版本发布1
博客介绍 这个作业属于哪个课程 https://edu.cnblogs.com/campus/xnsy/GeographicInformationScience/ 这个作业要求在哪里 https:// ...
- 将DataTable数据转换成List泛型数据
这里有一个实体类: public class Menuss { public int Id { get; set; } public string Te ...
- jmeter连接数据库操作
JDBC Connection Configuration 数据库连接配置 数据库连接配置器,用来连接数据库,是一个连接池. 界面介绍 1.右键线程组->添加->配置元件->JDBC ...
- 什么是LakeHouse?
1. 引入 在Databricks的过去几年中,我们看到了一种新的数据管理范式,该范式出现在许多客户和案例中:LakeHouse.在这篇文章中,我们将描述这种新范式及其相对于先前方案的优势. 数据仓库 ...