博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
HDU 1017 A Mathematical Curiosity【水,坑】
阅读量:5955 次
发布时间:2019-06-19

本文共 1489 字,大约阅读时间需要 4 分钟。

A Mathematical Curiosity

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)

Total Submission(s): 41995    Accepted Submission(s): 13502

Problem 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
110 120 330 40 0

 

Sample Output
Case 1: 2Case 2: 4Case 3: 5

 

Source
题目链接:
分析:一道水题被我写的乱七八糟的,各种格式不对,首先m,n只要有一个为0就break,然后就是这个输出空行,输出格式输错了,GG!
下面给出AC代码:
1 #include 
2 using namespace std; 3 int n,m; 4 int main() 5 { 6 int t; 7 scanf("%d",&t); 8 while(t--) 9 {10 int k=1;11 while(scanf("%d%d",&n,&m)&&n||m)12 {13 int ans=0;14 for(int i=1;i

 

转载地址:http://bvexx.baihongyu.com/

你可能感兴趣的文章
php读取大文件详解【OK】
查看>>
Gnome 快捷键汇总
查看>>
通过注册表修改我的文档等系统文件夹默认位置
查看>>
expdp 详解及实例
查看>>
C++中 栈的简单封装
查看>>
我的友情链接
查看>>
Linux常用命令--iconv
查看>>
varnish的了解与常用配置使用
查看>>
Product user profile information 没有导入
查看>>
DELL T410服务器U盘安装Centos7
查看>>
解读最具O2O属性—哈根达斯微信企业号的成功之道
查看>>
Sqlserver2008日志压缩
查看>>
虚拟机usb无线上网同时主机本地上网或无线无线上网
查看>>
View的事件分发机制
查看>>
Android Ndef Message解析
查看>>
mysqldump backup script
查看>>
coding4fun比赛总结
查看>>
Windows Server 2003 系统安装
查看>>
庖丁解牛获取连接状态数的awk数组命令
查看>>
5 kvm虚拟磁盘扩容
查看>>