{
  "type": "code_options",
  "author": "csdn.net",
  "source": "solution.md",
  "exercise_id": "061d051da6994ef4aad7ea7053f48e4e",
  "keywords": "算法高阶,数论算法,算法问题选编,整数的因子分解",
  "title": "用数组写水仙花数",
  "desc": [
    {
      "content": "\n定义一个整型数组 a[7]，在控制台输入任意的 7 个整数给数组赋值，输出数组中所 有的“水仙花数”。“水仙花数”是指一个三位数其各位数字的立方和等于该数本身。",
      "language": "markdown"
    }
  ],
  "answer": [
    {
      "content": "",
      "language": "java"
    }
  ],
  "prepared": [
    [
      {
        "content": "",
        "language": "java"
      }
    ],
    [
      {
        "content": "",
        "language": "java"
      }
    ],
    [
      {
        "content": "",
        "language": "java"
      }
    ]
  ],
  "template": {
    "content": "import java.util.Scanner;\npublic class Test {\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\tint arr[] = new int[7];\n\t\tSystem.out.println(\"请输入7个三位数：\");\n\t\tfor (int i = 0; i < arr.length; i++) {\n\t\t\tarr[i] = in.nextInt();\n\t\t}\n\t\tSystem.out.println(\"数组中的水花仙数为：\");\n\t\tfor (int i = 0; i < arr.length; i++) {\n\t\t\tint x = arr[i] / 100;\n\t\t\tint y = arr[i] / 10 % 10;\n\t\t\tint z = arr[i] % 10;\n\t\t\tif (arr[i] == x * x * x + y * y * y + z * z * z)\n\t\t\t\tSystem.out.println(i);\n\t\t}\n\t}\n}",
    "language": "java"
  },
  "node_id": "dailycode-1cd0efc5eab8483ca912341f4320382f",
  "license": "csdn.net",
  "created_at": 1637894160,
  "topic_link": "https://bbs.csdn.net/topics/600470189"
}