| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 75993 | 吴天辰 | 计算平均数 | C++ | Compile Error | 0 MS | 0 KB | 982 | 2024-06-01 12:03:44 |
#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 ; } */#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 ; } */
Main.cc:37:11: error: redefinition of 'const int N'
const int N=1e6+10;
^
Main.cc:3:11: note: 'const int N' previously defined here
const int N=1e6+10;
^
Main.cc:38:5: error: redefinition of 'int n'
int n,t;
^
Main.cc:4:5: note: 'int n' previously declared here
int n,t;
^
Main.cc:38:7: error: redefinition of 'int t'
int n,t;
^
Main.cc:4:7: note: 'int t' previously declared here
int n,t;
^
Main.cc:39:11: error: redefinition of 'bool vis [1000010]'
bool vis[N];
^
Main.cc:5:6: note: 'bool vis [1000010]' previously declared here
bool vis[N];
^
Main.cc: In function 'void deal(int)':
Main.cc:40:6: error: redefinition of 'void deal(int)'
void deal(int m)
^
Main.cc:6:6: note: 'void deal(int)' previously defined here
void deal(int m)
^
Main.cc: In function 'int main()':
Main.cc:57:5: error: redefinition of 'int main()'
int main()
^
Main.cc:23:5: note: 'int main()' previously defined here
int main()
^