A Mathematical Curiosity
A Mathematical Curiosity
Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other)
Total Submission(s) : 87 Accepted Submission(s) : 23
Font: Times New Roman | Verdana | Georgia
Font Size: ← →
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.
Input
Output
Sample Input
1 10 1
20 3
30 4
0 0
Sample Output
Case 1: 2
Case 2: 4
Case 3: 5
#include<iostream>
using namespace std;
int main()
{
int a,b,m,n,k,j,i,ans,num;
cin>>k;
for(b=0;b<k;b++)
{ num=0;
if(b)
cout<<endl;
while(cin>>n>>m&&m||n)
{ans=0;
for(i=1;i<n;i++)
for(j=i+1;j<n;j++)
{
if((i*i+j*j+m)%(i*j)==0)
ans++; }
cout<<"Case "<<++num<<": "<<ans<<endl;
}
} return 0;
}
A Mathematical Curiosity的更多相关文章
- 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 ...
- 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 1017A Mathematical Curiosity (暴力统计特殊要求个数)
传送门: http://acm.hdu.edu.cn/showproblem.php?pid=1017 A Mathematical Curiosity Time Limit: 2000/1000 M ...
- HDU 1017 A Mathematical Curiosity【看懂题意+穷举法】
//2014.10.17 01:19 //题意: //先输入一个数N,然后分块输入,每块输入每次2个数,n,m,直到n,m同一时候为零时 //结束,当a和b满足题目要求时那么这对a和b就是一组 ...
- HDOJ 1017 A Mathematical Curiosity
Problem Description Given two integers n and m, count the number of pairs of integers (a,b) such tha ...
- HDOJ-1017 A Mathematical Curiosity(淼)
http://acm.hdu.edu.cn/showproblem.php?pid=1017 # include <stdio.h> int find(int n, int m) { in ...
- HDU 1017 - A Mathematical Curiosity
题目简单,格式酸爽.. #include <iostream> using namespace std; int ans,n,m,p; int main() { cin>>p; ...
- 杭电OJ_DIY_YTW2_1001 A Mathematical Curiosity
Problem Description Given two integers n and m, count the number of pairs of integers (a,b) such tha ...
随机推荐
- iOS学习笔记(十五)——数据库操作(SQLite)
SQLite (http://www.sqlite.org/docs.html) 是一个轻量级的关系数据库.SQLite最初的设计目标是用于嵌入式系统,它占用资源非常少,在嵌入式设备中,只需要几百K的 ...
- Inside Qt Series (全集)
Inside Qt 系列 QObject这个 class 是 QT 对象模型的核心,绝大部分的 QT 类都是从这个类继承而来.这个模型的中心特征就是一个叫做信号和槽(signaland slot)的机 ...
- 用Qt开发Web和本地混合的应用
QtWebkit 模块使得Qt widget能够通过HTML的object标签嵌入到web页面中,并通过JavaScript代码进行访问,而Qt对象也能相应的访问web页面元素. 将Qt对象插入到we ...
- HashMap的工作原理(转)
HashMap的工作原理是近年来常见的Java面试题.几乎每个Java程序员都知道HashMap,都知道哪里要用HashMap,知道Hashtable和HashMap之间的区别,那么为何这道面试题如此 ...
- 用gradle管理android项目出现的问题以及解决方法
1.项目结构 最好是全部在root 项目配置 一个settings.gradle 一个build.gradle 2.多项目依赖 http://www.gradle.org/docs/current/u ...
- 让你提前知道软件开发(22):shell脚本文件操作
文章1部分 再了解C语言 shell脚本中的文件操作 [文章摘要] 编写shell脚本时,经常会涉及到对文件的操作,比方从文件里读取一行数据.向文件追加一行数据等. 完毕文件读写操作的方法有非常多,了 ...
- Wi-Fi万能钥匙:说是破解,其实有危险(转)
Wi-Fi 万能钥匙如此危险,怎样做才能让这种可能严重侵害公众利益的 app 在中国消失? 这个“钥匙”为什么能够破解 Wi-Fi?它真的是“破解” Wi-Fi 吗?两年前我就有这个疑问了,原谅我对一 ...
- C语言笔记之结构体
结构的本质是C语言的一种数据抽象,通俗的说,是基本数据类型的重组. 为什么要重组呢?由于基本数据类型不够用了.为什么不够用了呢?由于须要的信息类型太多了. 这是一个非常大的话题.信息本来是没有什么类型 ...
- HDU ACM 1054 Strategic Game 二分图最小顶点覆盖?树形DP
分析:这里使用树形DP做. 1.最小顶点覆盖做法:最小顶点覆盖 == 最大匹配(双向图)/2. 2.树形DP: dp[i][0]表示i为根节点,而且该节点不放,所需的最少的点数. dp[i][1]表示 ...
- 利用linux BT5来破解无线 破解无线
下面是自己整理的详细步骤,版权小冯全部. 一.提前准备好bt5的ISO镜像文件.和虚拟机,提前把虚拟机安装好.然后进行安装bt5. 二.进入页面,点击statx.进入可视化界面. 三.进入主界面后.下 ...