平衡数:对所有位的乘积判断是否是一个平方数。 public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); while (in.hasNext()) { getValue(in.nextInt()); } } public static void getValue(int data) { String s = String.valueOf(data); int R = 1; for (int i = 0; i < s.length(); i++) { R = R * (s.charAt(i) - '0'); } int r = (int) Math.sqrt((double) R); if (r * r == R) System.out.println("YES"); else System.out.println("NO"); } }
点赞 6

相关推荐

大野鸡:其实就是量,但是时间有限,1000题只要不是全中等简单,简单中等困难1-2-1,大概能打打比赛了(前20%),10000题就是下一个灵神
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务