| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 79102 | 刘浩宇 | 【一维数组】约瑟夫问题 | C++ | Wrong Answer | 0 MS | 264 KB | 310 | 2024-06-30 11:48:13 |
#include<bits/stdc++.h> using namespace std; queue<int> q; queue<int> p; int n,m,s=0; int main(){ cin>>n>>m; for (int i=1;i<=n;i++){ q.push(i); } while (q.size()!=1){ int ren=q.front(); q.pop(); s++; if(s==m){ s=0; }else{ q.push(ren); } } return 0; }
------Input------
20 1
------Answer-----
20
------Your output-----