解题思路:
注意事项:
参考代码:
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 人评分
【出圈】 (C语言代码)浏览:553 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:548 |
2006年春浙江省计算机等级考试二级C 编程题(2) (C语言代码)浏览:640 |
C语言程序设计教程(第三版)课后习题3.7 (C语言代码)浏览:326 |
简单的a+b (C语言代码)浏览:543 |
C语言程序设计教程(第三版)课后习题5.8 (C语言代码)浏览:1151 |
图形输出 (C语言代码)浏览:1375 |
C二级辅导-求偶数和 (C语言代码)浏览:671 |
字符逆序 (C语言代码)浏览:504 |
分解质因数 (C++代码)浏览:1471 |