Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
107655 | 王煜鑫 | 19按规则查找数组中的数据 | C++ | Accepted | 1 MS | 272 KB | 270 | 2025-01-18 11:07:22 |
#include <bits/stdc++.h> using namespace std; int a[1002]; int main() { int n,m; cin>>n>>m; for(int i=1;i<=n;i++){ cin>>a[i]; } int t; t=a[1]; for(int j=2;j<=m;j++){ cout<<t<<" "; t=a[t]; } cout<<t<<endl; return 0; }