Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
95723 | 吴天辰 | 杀人游戏 | C++ | Accepted | 1 MS | 272 KB | 491 | 2024-11-02 10:19:15 |
#include<bits/stdc++.h> using namespace std; const int N=1e6+10; int n,t; bool vis[N]; void deal(int m) { int tot=n; int p=0; for(int i=1;tot>1;i++) { if(i>n) i=1; if(vis[i]) continue; if(++p==m) { p=0; vis[i]=1; tot--; cout<<i<<" "; } } } int main() { cin>>n>>t; deal(t); return 0; } /*for(int i=1;i<=n;i++) if(!vis[i]) { printf("%d\n",i); return ; } */