import java.io.*; public class Hana{ static boolean Shuixian(int x){ boolean p=false; int y; int r=0, s=0,t=0; r=x % 10; s=( x % 100 )/10; t= x / 100; y=r*r*r+s*s*s+t*t*t; if ( x == y ){ p=true; } if ( x != y ){ p=false;} return p; } public static void main(String args[])throws IOException{ int i; String str; BufferedReader buf; buf=new BufferedReader(new InputStreamReader(System.in)); System.out.println("Input an number:"); str=buf.readLine(); i=Integer.parseInt(str); boolean a= Shuixian(i); if (a==true) { System.out.println("该数字是水仙花数字!"); }else{ System.out.println("该数字不是水仙花数字!"); } } }