第五题(NOIP2016)
#include<iostream>
using namespace std;
int main(){
int a[6];
int pi=0;
int pj=5;
int t,i;
while (pi<pj){
t=a[pi];
a[pi]=a[pj];
a[pj]=t;
pi++;
pj--;
}
for(i=0;i<6;i++)
cout<<a[i]<<",";
cout<<endl;
return 0;
}
- 【判断题】将第8行改成
pi<=pj不影响程序结果。
{{ select(1) }}
- 【判断题】程序输出六个数,逗号只出现在相邻两个数之间。
{{ select(2) }}
- 【判断题】如果
a={1,2,3,4,5,6},那么输出6,5,4,3,2,1。
{{ select(3) }}
- 【选择题】这个程序的功能是( )。
{{ select(4) }}
- 将已知序列翻转
- 求序列的逆
- 求序列的卷积
- 将原始数列随机打乱
- 【选择题】这个程序的时间复杂度是( )。
{{ select(5) }}
- O(n²)
- O(n)
- O(nlogn)
- O(n√n)
- 【选择题】如果
a={6,5,4,3,2,1},那么输出( )。
{{ select(6) }}
- 6,5,4,3,2,1
- 654321
- 123456
- 1,2,3,4,5,6,