解题思路:
注意事项:
参考代码:
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); for (int i = a; i <= b; i++) { int z = f(i); if (z != 0) { for (int j = 1; j < (z + "").length(); j++) { String s = z + ""; int v1 = Integer.parseInt(s.substring(0, j)); int v2 = Integer.parseInt(s.substring(j)); if (Math.sqrt(v1) % 1 == 0 && Math.sqrt(v2) % 1 == 0 && v1 > 0 && v2 > 0) { System.out.println(z); } } } } } public static int f(int i) { int z = 0; for (int m = 1; m <= Math.sqrt(i); m++) { if (m * m == i) { z = i; break; } } return z; } }
0.0分
1 人评分
A+B for Input-Output Practice (IV) (C++代码)浏览:829 |
人民币问题 (C语言代码)浏览:663 |
回文数字 (C++代码)浏览:823 |
点我有惊喜!你懂得!浏览:1220 |
C语言训练-排序问题<1> (C语言代码)浏览:1350 |
C语言程序设计教程(第三版)课后习题5.7 (C语言代码)浏览:930 |
C语言程序设计教程(第三版)课后习题6.4 (C语言代码)浏览:593 |
2006年春浙江省计算机等级考试二级C 编程题(1) (C语言代码)浏览:806 |
C语言程序设计教程(第三版)课后习题6.7 (C语言代码)浏览:518 |
C语言程序设计教程(第三版)课后习题6.6 (C语言代码)浏览:624 |