NSOJ A Mathematical Curiosity
来源:互联网 发布:centos 6.5 bond配置 编辑:程序博客网 时间:2024/06/09 22:13
A Mathematical Curiosity
时间限制: 1000ms
内存限制: 32768KB
HDU ID: 101764位整型: Java 类名:
上一题
提交 运行结果 统计 讨论版
下一题题目描述
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.
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.
输入
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.
输出
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.
样例输入
110 120 330 40 0
样例输出
Case 1: 2Case 2: 4Case 3: 5
来源
East Central North America 1999, Practice
思路:一道简单的水题,最难的是理解题意。
#include<stdio.h>int main(){int t;scanf("%d",&t);while(t--){int n,m,k=1,a,b,sum=0;while(scanf("%d %d",&n,&m)&&(n+m)){ sum=0;for(a=1;a<n;a++)for(b=a+1;b<n;b++)if((a*a+b*b+m)%(a*b)==0)sum++;printf("Case %d: %d\n",k++,sum);}if(t)printf("\n");}return 0;}
阅读全文
0 0
- NSOJ A Mathematical Curiosity
- A Mathematical Curiosity
- HDU1017 A Mathematical Curiosity
- A Mathematical Curiosity
- 1017 A Mathematical Curiosity
- A Mathematical Curiosity
- 1017 A Mathematical Curiosity
- hdu1017 A Mathematical Curiosity
- hdu1017-A Mathematical Curiosity
- hdu1017-A Mathematical Curiosity
- [ACM]A Mathematical Curiosity
- [catch]--A Mathematical Curiosity
- A Mathematical Curiosity
- A Mathematical Curiosity
- A Mathematical Curiosity
- HDOJ A Mathematical Curiosity
- A Mathematical Curiosity
- A Mathematical Curiosity
- 在App中打开淘宝
- angular数据获取后,无法及时更新到页面
- [leetcode]: 367. Valid Perfect Square
- windows下搭建Spark1.6源码调试阅读环境
- linux下用eclipse编译c++的pthread多线程配置
- NSOJ A Mathematical Curiosity
- java多线程学习——初识多线程
- Android APK反编译
- python去除script标签及里面的内容
- Android应用版本命名规范
- HTTP协议详解
- mysql免安装使用说明
- Hbuilder 使用chrome调试问题
- android adb常用指令