HDU 1017 A Mathematical Curiosity (数学)
A Mathematical Curiosity
Total Submission(s): 25871 Accepted Submission(s): 8174
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.
1 10 1
20 3
30 4
0 0
Case 1: 2
Case 2: 4
Case 3: 5
pid=1018" target="_blank">1018
1005pid=1021" target="_blank">1021
pid=1012" target="_blank">1012
对这道题不解释。题目的例子错了,那个1后面根本不要空行,还是看讨论区才知道。
代码:78MS
#include<iostream>
using namespace std;
int main(){
int n,m,cont=0,num=0;
int T;
cin>>T;
while(T--)
{
while(cin>>n>>m&&n!=0)
{
int a,b;
for(a=1;a<=n;++a){
for(b=a+1;b<n;++b){
if((a*a+b*b+m)%(a*b)==0)
cont++;
}
}
cout<<"Case "<<++num<<": "<<cont<<endl; //没打空格的同学伤不起啊。 。 。
cont=0;
}
num=0;
if(T)
cout<<endl;
}
}
HDU 1017 A Mathematical Curiosity (数学)的更多相关文章
- 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(枚举)
题目链接 Problem Description Given two integers n and m, count the number of pairs of integers (a,b) suc ...
- 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 1017 A Mathematical Curiosity (枚举水题)
Problem Description Given two integers n and m, count the number of pairs of integers (a,b) such tha ...
- 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 ...
随机推荐
- JavaScript也能求爱哦
这里面做了一个JavaScript的求爱小特效,效果例如以下: 不仅能出现以下的图的效果,还能够让这个图形尾随着鼠标转动哦,这里面仅仅是一个简单的没有修饰的小样例,基于这个样例能够让求爱,更加好玩了. ...
- iOS 调用短信、电话、邮件、浏览器等
1.调用 自带mail[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"mailto://admin@hzl ...
- NSLog 不打印中文 - 解决
解决方案:将项目的Debugger模式设置为 GDB 即可.(LLDB下不打印中文) 第一步: 第二步:
- 使用Dictionary泛型集合封装业务逻辑判断 z
C#2.0 提供了Dictionary 泛型类,它提供了从一组键到一组值的映射.字典中的每个添加项都由一个值及其相关联的键组成.通过键来检索值的速度是非常快的,接近于 O(1),这是因为 Dictio ...
- java实时监控mysql数据库变化
对于二次开发来说,很大一部分就找找文件和找数据库的变化情况 对于数据库变化.还没有发现比较好用的监控数据库变化监控软件. 今天,我就给大家介绍一个如何使用mysql自带的功能监控数据库变化 1.打开数 ...
- pgm转jpg
clc;clear all;for i=1:40for j=1:10image=imread(strcat('N:\FACE\orl_faces\s',...int2str(i),'\',int2st ...
- vs 默认的INC和LIB
用户环境变量添加 INCLUDE=C:\inc;c:\inc2 LIB=c:\lib 编辑文件C:\Users\Administrator\AppData\Local\Microsoft\MSBuil ...
- 通过Web启动本地应用程序
通过自定义协议在Web中启动本地应用程序 实例是打开本地安装的Word程序 注册自己的协议Windows Registry Editor Version 5.00 [HKEY_CLASSES_RO ...
- 寻路DEMO
网格场景的寻路算法DEMO 灰色格子为默认正常蓝色格子表示为障碍物,不可进入红色细条在格子周围,表示格子的墙,用于阻碍行走紫色为当前鼠标选中格子黄色为寻路的起始位置和结束位置.鼠标左键设置,CTRL+ ...
- 点云数据(point cloud) 【转】
转自caimagic的专栏 一:什么是点云数据 点云数据是指在一个三维坐标系统中的一组向量的集合.这些向量通常以X,Y,Z三维坐标的形式表示,而且一般主要用来代表一个物体的外表面形状.不经如此,除(X ...