hdoj 1017-A Mathematical Curiosity
来源:互联网 发布:java泛型里的? 编辑:程序博客网 时间:2024/06/04 18:05
A Mathematical Curiosity
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 41332 Accepted Submission(s): 13290Problem Description
Given two integers n and m, count the number of pairs of integers (a,b) such that 0 < a < b < n and (a^2+b^2 +m)/(ab) is an integer.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
You will be given a number of cases in the input. Each case is specified by a line containing the integers n and m. The end of input is indicated by a case in which n = m = 0. You may assume that 0 < n <= 100.
Output
For each case, print the case number as well as the number of pairs (a,b) satisfying the given property. Print the output for each case on one line in the format as shown below.
Sample Input
1 //多组测试数据(每组测试数据有多个案例,每组结束后输出空行)10 120 330 40 0
Sample Output
Case 1: 2Case 2: 4Case 3: 5
#include<iostream>#include<algorithm>using namespace std;int main(){ int k; cin>>k; while(k--) { int i=1; int a,b,m,n; while(cin>>n>>m&&m&&n) { //if(n==0&&m==0) //break; int ans=0; for(a=1;a<n;a++) { for(b=a+1;b<n;b++) { if((a*a+b*b+m)%(a*b)==0) ans++; } } cout<<"Case "<<i<<": "<<ans<<endl; i++; } if(k) cout<<endl; } return 0;}
阅读全文
0 0
- HDOJ 1017 A Mathematical Curiosity
- HDOJ 1017 A Mathematical Curiosity
- hdoj 1017 A Mathematical Curiosity
- hdoj 1017 A Mathematical Curiosity
- HDOJ 1017 A Mathematical Curiosity
- hdoj 1017 A Mathematical Curiosity
- HDOJ 1017 A Mathematical Curiosity
- 【HDOJ】【1017】A Mathematical Curiosity
- HDOJ 1017 A Mathematical Curiosity
- hdoj 1017-A Mathematical Curiosity
- HDOJ 1017-A Mathematical Curiosity
- HDOJ 1017 A Mathematical Curiosity
- HDOJ A Mathematical Curiosity
- HDOJ 1017 A Mathematical Curiosity解题报告
- hdoj.1017 A Mathematical Curiosity 20140728
- 1017 A Mathematical Curiosity
- 1017 A Mathematical Curiosity
- 1017 A Mathematical Curiosity
- ListView列表控件的介绍和性能优化
- CSDN机器学习笔记三 决策树、随机森林
- 使用Qt+PySide将UI文件转化为py文件
- List 自定义排序
- java基础
- hdoj 1017-A Mathematical Curiosity
- 2017.06.08
- 《JavaScript语言精粹》笔记--函数的调用
- java语言基础-数组的静态初始化
- CheckStyle, 强制你遵循编码规范
- Zabbix监控:监控端口
- 整体二分入门——区间k小数查询
- JDBC简单入门
- python中的文件操作
原创粉丝点击
热门IT博客
热门问题
老师的惩罚
人脸识别
我在镇武司摸鱼那些年
重生之率土为王
我在大康的咸鱼生活
盘龙之生命进化
天生仙种
凡人之先天五行
春回大明朝
姑娘不必设防,我是瞎子
程琳近况
程氏爱鸟
程维高与江总
程亚丽最新消息
吃喝闪1
吃人肉村
池城个人资料
池城近况
池华琼微博
池内博之混血
池贤秀
驰锐招聘网
齿留香秘制香口茶
斥候报告 步入正轨
斥候报告 锦鱼得水
斥候报告锦鱼得水
斥候套装
赤脚的基峰
赤脚的朋友们停播
赤警威龙百度影音
赤影战士天书
赤字增加的时期是
冲锋陷阵百度影音
冲上云霄2Michelle
冲上云霄2片头曲
冲上云霄2守护天使
冲天魔情炮
冲突世界配置
充话费送化肥
充能绿柱石怎么做
虫不知国语
虫血沸腾2
虫血沸腾2虫仙争霸
崇明县haobc
宠弟成夫
宠坏不良检察官
宠坏火爆检察官
宠物小精灵dp186
仇和简历
仇和近况
仇香美