HDU 1017 A Mathematical Curiosity(枚举)
Problem 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.
#include <cstdio>
#include <iostream>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <algorithm>
#include <cmath>
#include <map>
using namespace std;
//#define LOCAL int main()
{
#ifdef LOCAL
freopen("in.txt", "r", stdin);
#endif // LOCAL
//Start
int N;
cin>>N;
while(N--)
{
int i=;
int n,m;
while(cin>>n>>m)
{
if(n==&&m==)break;
i++;
int ans=;
for(double j=;j<n-;j++)
{
for(double k=j+;k<n;k++)
{
double t=(k*k+j*j+m)/(j*k);
if((int)t==t)ans++;
}
}
printf("Case %d: %d\n",i,ans);
}
if(N!=)printf("\n");
}
return ;
}
HDU 1017 A Mathematical Curiosity(枚举)的更多相关文章
- 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【水,坑】
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 数学题
解题报告:输入两个数,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 (输出格式,穷举)
#include<stdio.h> int main() { int N; int n,m; int a,b; int cas; scanf("%d",&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 ...
随机推荐
- C#中对属性和字段的理解
字段 C#中很少提到全局变量的概念, 引入了字段一词来代替全局变量, 但也并不是这样简单的, 字段会比全局变量的使用更难理解, 使用上会简单, 初学者当做成员变量或者全局变量不会有什么影响, 随着使用 ...
- 在GNU/Linux下使用Lilypond排版简谱
尽管GNU/Linux并非无所不能,但确实能在很多时候提供免费.开放的解决方案.这两天我想做一个简谱,在网上搜索乐谱排版软件,发现了基于GPL协议的Lilypond软件.只不过Lilypond是用来做 ...
- Facebook 在page添加自己开发的app
最初接到的需求是,在facebook主页中嵌入一个类似这样领取游戏礼包的页面. 一开始连facebook开发者中心在哪里都不知道,在万能的搜索框里面找到static html之类的第三方应用,但是这样 ...
- NEUQ1051: 谭浩强C语言(第三版)习题6.7
//C代码简直难看到家,求大神知道如何写出复用性好的,维护性强的代码... //格式错误了好几次,最后发现是are和数字之间多了个空格......本来一直以为是最后的换行多了,费劲搞掉了. #incl ...
- 【Time系列一】datetime的妙用
今天在弄个自动关机小脚本的时候,遇到了时间转换的问题,也难怪,以前没学过, 不能怪我不会哦! 首先,先学会打印出当前时间的几种方式 参考开源社区: http://my.oschina.net/u/1 ...
- centos6 + tomcat+ jdk配置步骤
1. 获取tomcat, jdk安装文件 mkdir /media/smbdirmount -o username=pas,password=111111 //109.110.100.50/pas / ...
- mysql中文显示问号
mysql插入中文后显示为?,查到http://blog.csdn.net/chenxingzhen001/article/details/7567812中方法,即 在my.ini配置文件中的[myd ...
- 从安装.net Core 到helloWord(Mac上)
最近听说微软 正式发不了.netCore 1.0 于是就安装了 并安装了vs Code 用于编写一些.net程序 一. .netCore的安装: 首先需要通过brew安装openssl(相信homeB ...
- react学习笔记-05 lifecycle
根据React官网,react有三个生命状态:装载(Mounting),更新(updating),卸载() 一:装载 装载:componentWillMount/componentDidMount(组 ...
- php浏览历史记录的方法
本文实例讲述了php浏览历史记录的方法.分享给大家供大家参考.具体实现方法如下: /** * 商品历史浏览记录 * $data 商品记录信息 */private function _history($ ...