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 ...
随机推荐
- PCB C# MongoDB 查询(SQL,NOSQL,C#对比)
一.准备阶段 1.查询数据清单准备 2.这里先将SQL语句执行顺序列出来,方便后面语句对比更好理解 ()SELECT ()DISTINCT ()<Top Num> <select l ...
- E20170627-gg
ring n. 戒指,指环; 铃声,钟声; 环形物; 拳击场; vi. 按铃,敲钟; 回响; 成环形; rear n. 后部,背面,背后; 臀部; (舰队或军队的) 后方,后尾,殿后部队; ...
- 无限极分类算法 thinkphp
<?php/** 本类实现的是无限级递归分类的管理*/class InfiniteLevel{ public $id_str=""; public function add_ ...
- mysql中 groupby分组
引用自http://www.cnblogs.com/mo-beifeng/archive/2012/02/07/2341886.html#2341105 --按某一字段分组取最大(小)值所在行的数据 ...
- ajax 以json 的形式来传递返回参数的实例
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestWcf.aspx.c ...
- [Luogu 1312] noip11 Mayan游戏
[Luogu 1312] noip11 Mayan游戏 Problem: Mayan puzzle是最近流行起来的一个游戏.游戏界面是一个 7 行5 列的棋盘,上面堆放着一些方块,方块不能悬空堆放,即 ...
- PHP电影小爬虫(2)
学习了别人的爬虫后自己改的一个,算是又回顾了一下php的使用 我们来利用simple_html_dom的采集数据实例,这是一个PHP的库,上手很容易.simple_html_dom 可以很好的帮助我们 ...
- ACM_汉诺塔问题(递推dp)
Problem Description: 最近小G迷上了汉诺塔,他发现n个盘子的汉诺塔问题的最少移动次数是2^n-1,即在移动过程中会产生2^n个系列.由于发生错移产生的系列就增加了,这种错误是放错了 ...
- scala 变量定义,基本操作符
scala是jvm语言,它将面向对象与函数风格结合的很好,它可以访问任何java类库并很好的结合使用. 它可以使程序更简单,同时可利用并发的威力. scala基本语法: package com.tes ...
- Bootstrap3模态框Modal垂直居中样式
1,Bootstrap 模态框插件Bootbox垂直居中样式: <!DOCTYPE html> <html lang="en"> <head> ...