Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
108743 陈铎文 19按规则查找数组中的数据 C++ Accepted 1 MS 276 KB 216 2025-01-21 16:04:35

Tests(10/10):


Code:

#include<bits/stdc++.h> using namespace std; int main(){ int a[1001],n,m,s=1; cin>>n>>m; for(int i=1;i<=n;i++){ cin>>a[i]; } for(int i=1;i<=m;i++){ cout<<a[s]<<" "; s=a[s]; } return 0; }