题库练习 阅读C++程序填写结果:#include<bits/stdc++.h>

A62499 | 阅读C++程序填写结果:#include<bits/stdc++.h>

来源2024年
时间限制1s
内存限制256MB
通过 / 提交0/0

题目描述

阅读C++程序填写结果:

#include<bits/stdc++.h>
using namespace std;
const int maxn=100 + 7;
int p1[maxn],p2[maxn];
int main()
{
    int n; scanf("%d",&n);
    for(int i= 1;i<= n; ++i){
        scanf("%d",&p1[i]);
    }
    for(int i =1; i <= n; ++i){
        p2[i]= p1[p1[i]];
    }
    for(int i=1;i<= n; ++i){
        cout<<p2[i]<<" ";
    } 
cout<<"\n";
return 0;
}
C++ 编辑器
输入
输出