提交时间:2023-02-25 15:10:59

运行 ID: 10497

#include<bits/stdc++.h> using namespace std; int main() { int a[8],b[8]; for(int i=0;i<8;i++){ cin>>b[i]; } for(int i=0;i<8;i++){ cin>>a[i]; } for(int i=0;i<7;i++){ for(int j=0;j<7-i;j++) if(a[j]<a[j+1]){ int temp1=0,temp2=0; temp1=a[j]; a[j]=a[j+1]; a[j+1]=temp1; temp2=b[j]; b[j]=b[j+1]; b[j+1]=temp2; } } for(int i=0;i<8;i++){ cout<<b[i]<<" "; } return 0; }