Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
113104 程余天皓 环形密码 C++ Wrong Answer 1 MS 284 KB 426 2025-03-15 11:46:11

Tests(0/10):


Code:

#include<bits/stdc++.h> using namespace std; int n, m; int r = 0,bs = 0; int live = 0; int die[1001]; int a[301]; int main() { cin >> n >> m; for(int i=1;i<=n;i++){ cin>>a[i]; } live = n+1; while(live != 1){ r++; if(r>n){ r = 1; } if(die[r]==1){ continue; } bs++; if(bs == m){ cout<< r <<" "; die[r]=1; bs = 0; live--; m=a[r]; } } return 0; }


Run Info:

------Input------
10 3 8 3 6 3 4 10 3 10 3 2
------Answer-----
6 3 3 10 8 3 3 2 10 4
------Your output-----
3 9 2 6 1 7 4 10 8 5