Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
59484 | 万正钰 | 环形密码 | C++ | Accepted | 1 MS | 276 KB | 573 | 2023-10-28 16:40:03 |
#include<iostream> #include<cstring> #include<cmath> using namespace std; int main(){ int m,n; cin>>n>>m; int a[131]={0}; for(int i=1;i<=n;i++){ cin>>a[i]; } int cnt=0; int i=0; int pos=1; while(cnt<n){ if(a[pos]!=0){ i++; if(i==m){ cnt++; m=a[pos]; cout<<a[pos]<<' '; a[pos]=0; i=0; } } pos++; if(pos==n+1) pos=1; } return 0; }