{
  "question_id": 7443359,
  "question_title": "数组排序",
  "question_content": "<p>给定n&#xff08;n是偶数&#xff0c;且n≤100&#xff09;个正整数&#xff0c;所有正整数均≤10000&#xff1b;从前往后依次遍历这个数组&#xff0c;每两个为一组进行处理&#xff0c;若一组中的任意一个元素能被3或者5整除&#xff0c;则交换这两个元素的位置&#xff1b;否则不动&#xff1b;全部处理完成后&#xff0c;逆序输出整个数组。\n例如给定序列&#xff1a; 99 35 83 38 &#xff0c; 处理完成后得到&#xff1a;38 83 99 35\n给定序列&#xff1a; 6 7 3 4 &#xff0c;处理完成后得到&#xff1a;3 4 6 7</p>",
  "difficulty": "困难",
  "answer_id": 53420448,
  "answer_content": "<pre>\n<code>#include &lt;stdio.h&gt;\n#include &lt;math.h&gt;\n\nint main()\n{\n\nint i,j,n,a[10005],t;\nscanf(&#34;%d&#34;,&amp;n);\nfor(i&#61;0;i&lt;n;i&#43;&#43;){\n    scanf(&#34;%d&#34;,&amp;a[i]);\n    if(i%2&#61;&#61;1){\n        if((a[i]%3&#61;&#61;0)||(a[i]%5&#61;&#61;0)||(a[i-1]%3&#61;&#61;0)||(a[i-1]%5&#61;&#61;0)){\n            t&#61;a[i];\n            a[i]&#61;a[i-1];\n            a[i-1]&#61;t;\n        }\n    }\n}\nfor(i&#61;n-1;i&gt;&#61;0;i--){\n    printf(&#34;%d &#34;,a[i]);\n}\n\n\n}</code></pre>\n\n<p><img alt=\"\" height=\"225\" src=\"https://img-ask.csdnimg.cn/upload/1622968886801.png\" width=\"476\" /></p>\n",
  "tag_name": "c语言",
  "cpp": "#include <stdio.h>\n#include <math.h>\nint main()\n{\n\tint i,j,n,a[10005],t;\n\tscanf(\"%d\",&n);\n\tfor(i=0;i<n;i++){\n\t\tscanf(\"%d\",&a[i]);\n\t\tif(i%2==1){\n\t\t\tif((a[i]%3==0)||(a[i]%5==0)||(a[i-1]%3==0)||(a[i-1]%5==0)){\n\t\t\t\tt=a[i];\n\t\t\t\ta[i]=a[i-1];\n\t\t\t\ta[i-1]=t;\n\t\t\t}\n\t\t}\n\t}\n\tfor(i=n-1;i>=0;i--){\n\t\tprintf(\"%d \",a[i]);\n\t}\n}",
  "topic_link": "https://bbs.csdn.net/topics/600470257",
  "status": 1,
  "keywords": "算法初阶,基础知识,特征序列,概率分析和随机算法,概率分析和指示器随机变量的进一步使用",
  "license": "csdn.net",
  "notebook": {
    "cpp": "https://codechina.csdn.net/csdn/csdn-daily-code/-/jupyter/master/data/notebook/answer/ipynb/cpp/30.ipynb?type=file"
  },
  "notebook_enable": 1,
  "author": "sibolingeve"
}