| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 150042 | 杨峻熙 | 打印每一趟插入排序 | C++ | Compile Error | 0 MS | 0 KB | 468 | 2026-03-21 17:02:35 |
#include<bits/stdc++.h> using namespace std; int main(){ void print(vector<int>& a){ for(int i=0;i<a.size();++i){ if(i>0) cout<<" "; cout<<a[i]; } cout<<endl; } int main(){ int n; cin>>n; vector<int> a(n); for(int i=0;i<n;++i){ cin>>a[i]; } for(int i=1;i<n;++i){ int key = a[i]; int j=i-1; while(j>=0&&a[j]>key){ a[j+1]=a[j]; j--; } a[j+1]=key; print(a); } } return 0; }
Main.cc: In function 'int main()':
Main.cc:4:28: error: a function-definition is not allowed here before '{' token
void print(vector& a){
^
Main.cc:30:1: error: expected '}' at end of input
}
^