{
  "question_id": 7445574,
  "question_title": "整数分解",
  "question_content": "<p>输入一个整数&#xff0c;将其按7进制位分解为各乘式的累加和&#xff08;下图为输出结果&#xff09;</p>\n<p style=\"text-align:center\"><img alt=\"\" src=\"https://img-ask.csdnimg.cn/upload/1623209867965.jpg\" />\n </p>",
  "difficulty": "简单",
  "answer_id": 53424293,
  "answer_content": "<pre>\n<code class=\"language-cpp\">#include&lt;stdio.h&gt;\n#define X 7\n\nint main()\n{\n    int i&#61;0;\n    int mod,num&#61;720;\n\n    while(num)\n    {\n        mod&#61;num%X;\n        num/&#61;X;\n        if(mod!&#61;0)\n            printf(&#34;%d*7^%d%c&#34;,mod,i,(num&gt;0)?&#39;&#43;&#39;:&#39;\\n&#39;);\n        i&#43;&#43;;\n    }\n\n    return 0;\n}</code></pre>\n\n<p> </p>\n",
  "tag_name": "c语言",
  "cpp": "#include<stdio.h>\n#define X 7\nint main()\n{\n\tint i=0;\n\tint mod,num=720;\n\twhile(num)\n\t{\n\t\tmod=num%X;\n\t\tnum/=X;\n\t\tif(mod!=0)\n\t\t\tprintf(\"%d*7^%d%c\",mod,i,(num>0)?'+':'\\n');\n\t\ti++;\n\t}\n\treturn 0;\n}",
  "topic_link": "https://bbs.csdn.net/topics/600470155",
  "status": 1,
  "keywords": "算法高阶,数论算法,算法问题选编,整数的因子分解",
  "license": "csdn.net",
  "notebook": {
    "cpp": "https://codechina.csdn.net/csdn/csdn-daily-code/-/jupyter/master/data/notebook/answer/ipynb/cpp/46.ipynb?type=file"
  },
  "notebook_enable": 1,
  "author": "zhangxiaox"
}