{
  "type": "code_options",
  "author": "csdn.net",
  "source": "solution.md",
  "exercise_id": "226a3e3e1d564f45aeb6e475d269a13d",
  "keywords": "图算法,算法高阶,最小生成树,最小生成树的形成",
  "title": "求两个给定正整数的最大公约数和最小公倍数",
  "desc": [
    {
      "content": "\n<pre><p>本题要求两个给定正整数的最大公约数和最小公倍数。\n输入格式:\n输入在两行中分别输入正整数x和y。\n输出格式:\n在一行中输出最大公约数和最小公倍数的值。\n</pre><pre>输入样例1:\n在这里给出一组输入。\n例如&#xff1a;</p><pre><code>100\n1520</code></pre><p>输出样例1:\n在这里给出相应的输出。\n例如&#xff1a;</p><pre><code>20 7600</code></pre></pre>",
      "language": "markdown"
    }
  ],
  "answer": [
    {
      "content": "",
      "language": "python"
    }
  ],
  "prepared": [
    [
      {
        "content": "",
        "language": "python"
      }
    ],
    [
      {
        "content": "",
        "language": "python"
      }
    ],
    [
      {
        "content": "",
        "language": "python"
      }
    ]
  ],
  "template": {
    "content": "def hcf(x, y):\n   if x > y:\n\t   smaller = y\n   else:\n\t   smaller = x \n   for i in range(1,smaller + 1):\n\t   if((x % i == 0) and (y % i == 0)):\n\t\t   hcf = i \n   return hcf\ndef lcm(x, y): \n   if x > y:\n\t   greater = x\n   else:\n\t   greater = y\n   while(True):\n\t   if((greater % x == 0) and (greater % y == 0)):\n\t\t   lcm = greater\n\t\t   break\n\t   greater += 1\n   return lcm\nnum1 = int(input(\"输入第一个数字: \"))\nnum2 = int(input(\"输入第二个数字: \"))\nprint(\"最大公约数为\",hcf(num1, num2),\"最小公倍数为\",lcm(num1,num2))",
    "language": "python"
  },
  "node_id": "dailycode-10743c3216c44bb1a4acda922204abf7",
  "license": "csdn.net",
  "created_at": 1637894159,
  "topic_link": "https://bbs.csdn.net/topics/600469988"
}