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 ...
随机推荐
- ImageView 设置图片来自:http://blog.csdn.net/lincyang/article/details/6562163
android doc中是这样描述的: public void setImageResource (int resId) 这是其中的一个方法,参数resld是这样: ImageView.setImag ...
- Dictionary GetOrAdd
public static TValue GetOrAdd<TKey,TValue>( this Dictionary<TKey,TValue> dictionary, TKe ...
- .NET:CLR via C#:Runtime Serialization
Making a Type Serializable The SerializableAttribute custom attribute may be applied to reference ty ...
- pytest文档25-conftest.py作用范围
前言 一个测试工程下是可以有多个conftest.py的文件,一般在工程根目录放一个conftest.py起到全局作用. 在不同的测试子目录也可以放conftest.py,作用范围只在该层级以及以下目 ...
- Selenium2+python自动化37-爬页面源码(page_source)
前言 有时候通过元素的属性的查找页面上的某个元素,可能不太好找,这时候可以从源码中爬出想要的信息.selenium的page_source方法可以获取到页面源码. selenium的page_sour ...
- iOS宏(自己使用,持续更新)
// 直接从RGB取颜色(RGB 0xFF00FF)#define UICOLOR_FROM_RGB(rgbValue) \[UIColor colorWithRed:((float)((rgbVal ...
- Json解析教程(四.FastJson 的使用)
简介 Fastjson是一个Java语言编写的高性能功能完善的JSON库. 高性能 fastjson采用独创的算法,将parse的速度提升到极致,超过所有json库,包括曾经号称最快的jackson. ...
- Vue路由scrollBehavior滚动行为控制锚点
使用前端路由,当切换到新路由时,想要页面滚到顶部,或者是保持原先的滚动位置,就像重新加载页面那样. vue-router 能做到,而且更好,它让你可以自定义路由切换时页面如何滚动. 注意: 这个功能只 ...
- ifconfig无输出的解决办法
问题 执行 ifconfig 命令无任何报错,也无任何输出信息 [root@linuxprobe ~]# ifconfig [root@linuxprobe ~]# 排错 1. 检查PATH变量 [r ...
- System.Net.Http.Formatting的nuget版本冲突问题
已经添加了nuget Microsoft.AspNet.WebApi.Client 调用System.Net.Http.HttpClient.PostAsJsonAsync的时候报如下的错误: C ...