Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
122497 何辰熠 19按规则查找数组中的数据 C++ Accepted 1 MS 276 KB 276 2025-06-21 08:58:18

Tests(10/10):


Code:

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