Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
23753 | 肖静 | 选择排序-函数 | C++ | Accepted | 3 MS | 776 KB | 446 | 2022-03-20 11:43:59 |
#include<iostream> #include<cstdio> using namespace std; int main() { int n; void sortl(int x); scanf("%d",&n); sortl(n); return 0; } void sortl(int x) { int a[1000]; for(int b=0;b<x;b++) { cin>>a[b]; } for(int e=0;e<x;e++) { for(int b=0;b<x;b++) { int c; if( x>b+1 && a[b] > a[b+1] ) { c=a[b]; a[b]=a[b+1]; a[b+1]=c; } } } for(int b=0;b<x;b++) { printf("%d ",a[b]); } }