Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
79281 何嘉乐 【一维数组】约瑟夫问题 C++ Runtime Error 0 MS 264 KB 357 2024-06-30 17:13:12

Tests(0/3):


Code:

#include<bits/stdc++.h> using namespace std; int main(){ queue<int>live; int n,m; cin>>n>>m; for(int i=1;i<=n;i++){ live.push(i); } int bs=0; while(live.size()!=1){ int a=live.front(); live.pop(); bs++; if(bs==5){ live.pop(); bs=0; } else{ live.push(a); } } cout<<live.front(); return 0; }


Run Info:

Runtime Error:Segmentation fault