Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
44606 | 刁泓烨 | 报数 | C++ | Accepted | 3 MS | 272 KB | 470 | 2023-02-18 19:47:23 |
#include <iostream> #include <stdio.h> #include <cstring> #include <cmath> using namespace std; int main() { int n,sha=0,baoshu=0,i=1; cin>>n; int live[n+1]={0}; while(sha<n-1){ if(live[i]==1){ i++; if(i==n+1){ i=1; } continue; } baoshu++; if(baoshu==3){ live[i]=1; sha++; baoshu=0; }if(i==n){ i=1; }else{ i++; } } while(n>0){ if(live[n]==0){ cout<<n; } n--; } return 0; }