{
  "question_id": 3082820,
  "question_title": "逆序存放数组中的数据，并输出指定元素",
  "question_content": "<pre><p>将给定的n个整数存入数组中&#xff0c;将数组中的这n个数逆序存放&#xff0c;再按要求输出指定的数组元素。\n输入格式:\n在第一行中给出一个正整数n&#xff08;1≤n≤10&#xff09;。第二行输入n个整数&#xff0c;用空格分开。第三行输入一个非负整数m&#xff08;m&lt;n&#xff09;。\n输出格式:\n在一行中输出逆序存放后下标为m的数组元素。行末无空格。</pre>\n输入样例:</p>\n<pre>\n<code>6\n10 8 1 2 3 4\n2</code></pre>\n<p>输出样例:</p>\n<pre>\n<code>2</code></pre>",
  "difficulty": "中等",
  "answer_id": 19384015,
  "answer_content": "<pre>\n<code>#include &lt;stdio.h&gt;\n#include &lt;stdlib.h&gt;\n\nint main()\n{\n    int n,m;\n    scanf(&#34;%d&#34;,&amp;n);\n    if(n&lt;1||n&gt;10){\n       printf(&#34;1≤n≤10&#34;);\n       return 0;\n    }\n    int *a &#61; (int*)malloc(sizeof(int)*n);\n    for(int i&#61;n-1; i&gt;&#61;0; i-- ){\n        scanf(&#34;%d&#34;,&amp;a[i]);\n    }\n    scanf(&#34;%d&#34;,&amp;m);\n    if(m&lt;0||m&gt;&#61;n){\n       printf(&#34;0≤m&lt;n&#34;);\n       return 0;\n    }\n    printf(&#34;%d&#34;,a[m]);  \n    return 0;\n}</code></pre>\n\n<p> </p>",
  "tag_name": "c语言",
  "cpp": "#include <stdio.h>\n#include <stdlib.h>\nint main()\n{\n\tint n,m;\n\tscanf(\"%d\",&n);\n\tif(n<1||n>10){\n\t   printf(\"1≤n≤10\");\n\t   return 0;\n\t}\n\tint *a = (int*)malloc(sizeof(int)*n);\n\tfor(int i=n-1; i>=0; i-- ){\n\t\tscanf(\"%d\",&a[i]);\n\t}\n\tscanf(\"%d\",&m);\n\tif(m<0||m>=n){\n\t   printf(\"0≤m<n\");\n\t   return 0;\n\t}\n\tprintf(\"%d\",a[m]);  \n\treturn 0;\n}",
  "topic_link": "https://bbs.csdn.net/topics/600469863",
  "status": 1,
  "keywords": "算法高阶,数论算法,元素的幂,算法问题选编",
  "license": "csdn.net",
  "notebook": {
    "cpp": "https://codechina.csdn.net/csdn/csdn-daily-code/-/jupyter/master/data/notebook/answer/ipynb/cpp/120.ipynb?type=file"
  },
  "notebook_enable": 1,
  "author": "qq_41157240"
}