hdu_1017_A Mathematical Curiosity_201310280948
A Mathematical Curiosity
http://acm.hdu.edu.cn/showproblem.php?pid=1017
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 22366 Accepted Submission(s): 7021
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.
解 输出每次n和m对应的所有解的个数,但是要注意在每一块的输出中间有空行。
第一个输入的N的作用是 是有几个CASE的意思
代码:
#include <stdio.h>
#include <math.h> int main()
{
int N;
scanf("%d",&N);
while(N--){
int k=;
int m,n;
while(scanf("%d %d",&n,&m),n||m)
{
int i,j,num=;
double t;
for(i=;i<n;i++)
for(j=i+;j<n;j++)
{
t = (i*i+j*j+m)*1.0/(i*j);
if(fabs(t-(int)t)<0.00000001)//这两句还可以这样处理 (i*i+j*j+m)*1.0%(i*j)==0
num++;
}
printf("Case %d: %d\n",k++,num);
}
if(N)
printf("\n");
}
return ;
}
弄清题意
hdu_1017_A Mathematical Curiosity_201310280948的更多相关文章
- [转]Mathematical Induction --数学归纳法1
Mathematical Induction Mathematical Induction is a special way of proving things. It has only 2 step ...
- [中英双语] 数学缩写列表 (List of mathematical abbreviations)
List of mathematical abbreviations From Wikipedia, the free encyclopedia 数学缩写列表 维基百科,自由的百科全书 This ar ...
- A Mathematical Curiosity 分类: HDU 2015-06-25 21:27 11人阅读 评论(0) 收藏
A Mathematical Curiosity Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Ot ...
- Part 14 Mathematical functions in sql server
Part 29 Mathematical functions in sql server
- Applied Functional Analysis(Applications to Mathematical Physics ) E.Zeidler
Applied Functional Analysis(Applications to Mathematical Physics ) E.Zeidler More: QQ565055403
- NVIDIA CG语言 函数之所有数学类函数(Mathematical Functions)
数学类函数(Mathematical Functions) abs(x) 返回标量和向量x的绝对值 如果x是向量,则返回每一个成员的绝对值 acos(x) 返回标量和向量x的反余弦 x的范围是[-1, ...
- 《Principles of Mathematical Analysis》-chaper1-实数系与复数系
今天我们开始简单的介绍数学分析这门课程,参考教材是Walter Rudin著的<Principles of Mathematical Analysis> 对于一门新课你最开始可能会问的是: ...
- 《Mathematical Olympiad——组合数学》——染色问题
恢复 继续关于<Mathematical Olympiad——组合数学>中问题的分析,这一篇文章将介绍有关染色的问题. 问题一: 将一些石头放入10行14列的矩形方格表内,允许在每个单元 ...
- A Mathematical Curiosity
A Mathematical Curiosity Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Java/O ...
随机推荐
- 03_jni_helloworld_完成
通过ndk-build编译C的代码.cd /d就是直接进到我的目录里面. 打开ANDROID-MK.HTML Introduction: This document describes the syn ...
- 9.9 NOIP模拟题
9.9 NOIP模拟题 T1 两个圆的面积求并 /* 计算圆的面积并 多个圆要用辛普森积分解决 这里只有两个,模拟计算就好 两圆相交时,面积并等于中间两个扇形面积减去两个三角形面积 余弦定理求角度,算 ...
- 非常无聊——STD::sort VS 基数排序
众所周知,Std::sort()是一个非常快速的排序算法,它基于快排,但又有所修改.一般来说用它就挺快的了,代码一行,时间复杂度O(nlogn)(难道不是大叫一声“老子要排序!!”就排好了么...). ...
- 1、Web MVC简介
- springboot自定义常量配置
现在你建一个类: import org.springframework.boot.context.properties.ConfigurationProperties; /** * Created b ...
- T-SQL语句以及几个数据库引擎
创建表 注意事项: A.自增长 B.数据库引擎, ISAM 是一个定义明确且历经时间考验的数据表格管理方法,它在设计之时就考虑到数据库被查询的次数要远大于更新的次数.因此,IS ...
- (转)postgis常用函数介绍(二)
http://blog.csdn.net/gisshixisheng/article/details/47903151 概述: 书接上文,本文继续讲解Postgres中常用的空间函数的使用. 常用函数 ...
- makefile 与 make
所要完成的Makefile 文件描述了整个工程的编译.连接等规则.其中包括:工程中的哪些源文件需要编译以及如何编译.需要创建那些库文件以及如何创建这些库文件.如何最后产生我们想要的可执行文件.尽管看起 ...
- PAC代理语法含义与书写规范
一直以来使用ShadowSocksFQ,基本上默认的PAC代理模式己能满足所需,实在个别pac不方便的就转成用全局代理模式也能愉快FQ. 只是最近学习前端的知识,需要FQ访问 MDN web docs ...
- Java中内部类详解—匿名内部类
什么是内部类? 将一个类A定义在另一个类B里面,里面的那个类A就称为内部类,B则称为外部类. 成员内部类 定义在类中方法外的类. 定义格式: class 外部类 { class 内部类{ } } ...