参考代码:
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); p(scanner.nextInt(), scanner.nextInt()); } public static void p(int a, int b) { for(int i = a; i <= b; i++) if(judge(i) && splitJudge(i)) System.out.println(i); } public static boolean splitJudge(int in) { String original = new String().valueOf(in); int n = original.length(); for(int i = 1; i < n; i++) { String s1 = original.substring(0, i); String s2 = original.substring(i); int a = Integer.parseInt(s1); int b = Integer.parseInt(s2); if(judge(a) && judge(b)) return true; } return false; } public static boolean judge(int x) { if(x == 0) return false; double a = Math.sqrt(x); int b = (int)a; if(a == b) return true; return false; } }
0.0分
5 人评分
C二级辅导-求偶数和 (C语言代码)浏览:632 |
汽水瓶 (C语言代码)浏览:664 |
C语言程序设计教程(第三版)课后习题5.7 (C语言代码)浏览:537 |
钟神赛车 (C语言代码)浏览:665 |
一元一次方程 (C语言代码)浏览:4247 |
交换Easy (C语言代码)浏览:805 |
企业奖金发放 (C语言代码)浏览:2462 |
神奇的fans (C语言代码)浏览:1125 |
母牛的故事 (C语言代码)浏览:495 |
C语言程序设计教程(第三版)课后习题6.5 (C语言代码)浏览:548 |