/ 科创班 /

记录详情

Accepted


  
# 状态 耗时 内存占用
#1 Accepted 2ms 384.0 KiB
#2 Accepted 1ms 344.0 KiB
#3 Accepted 3ms 352.0 KiB

代码

#include <iostream>

using namespace std;

int main()
{
    int n;      //数组长度
    cin >> n;
    int *a = new int[n];
    for(int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    int temp;
    for(int i = 0; i < n / 2; i++)
    {
        temp = a[i];
        a[i] = a[n - 1 - i];
        a[n - 1 - i] = temp;
    }
    for(int i = 0; i < n; i++)
    {
        cout << a[i] << " ";
    }
    cout << endl;
}

信息

递交者
类型
递交
题目
逆置数组
题目数据
下载
语言
C++
递交时间
2018-07-14 20:12:17
评测时间
2018-07-14 23:29:16
评测机
分数
30
总耗时
7ms
峰值内存
384.0 KiB