hud.1017 A Mathematical Curiosity
来源:互联网 发布:电脑数据丢失怎么办 编辑:程序博客网 时间:2024/06/18 04:50
http://acm.hdu.edu.cn/showproblem.php?pid=1017
import java.util.Scanner;public class Mathematical{public static void main(String[] args){int n,m,N;int count = 1;Scanner input = new Scanner(System.in);N = input.nextInt();while(N-- != 0){count = 1;while(true){n = input.nextInt();m = input.nextInt();if (m == 0 && n == 0){break;}else {System.out.println("Case "+count+": "+pairs(n,m));count++;}}if (N != 0){System.out.println();}}input.close();}private static int pairs(int n, int m){int count = 0;for (int i = 1; i < n; i++){for (int j = i + 1; j < n; j++){if (is(calculate(i, j, m))){count++;}}}return count;}private static double calculate(int a,int b,int m){return (Math.pow(a, 2) + Math.pow( b, 2) + m)/(a*b);}private static boolean is(double a){if (a == (int)a){return true;}return false;}}水题一道,注意格式。
0 0
- hud.1017 A Mathematical Curiosity
- 1017 A Mathematical Curiosity
- 1017 A Mathematical Curiosity
- 1017 A Mathematical Curiosity
- 1017 A Mathematical Curiosity
- 1017 A Mathematical Curiosity
- HDU 1017 A Mathematical Curiosity
- HDU 1017 A Mathematical Curiosity
- HDU 1017A Mathematical Curiosity
- HDU 1017 A Mathematical Curiosity
- hdu 1017 A Mathematical Curiosity
- HDU 1017 A Mathematical Curiosity
- HDU--1017--A Mathematical Curiosity
- HDOJ 1017 A Mathematical Curiosity
- hdu 1017 A Mathematical Curiosity
- HDU:1017 A Mathematical Curiosity
- hdu 1017 A Mathematical Curiosity
- HDOJ 1017 A Mathematical Curiosity
- 解决eclipse中出现Resource is out of sync with the file system问题
- finally问题
- 【学习笔记】AB调方法
- php设计模式学习记录(下)
- 23种设计模式之工厂方法模式
- hud.1017 A Mathematical Curiosity
- 链路层学习笔记
- 2015NCHU第一届ACM新生选拔赛E题题解
- 23种设计模式之抽象工厂模式
- 《CSDN Markdown简明教程》课程上线!
- 炮弹准确打击的计算方法
- 常见 MVC 框架比较
- 23种设计模式之建造者模式
- C++静态成员变量和静态成员函数