#include <iostream> using namespace std; int main(){ int N; cin>>N; int a[N]; int c=0; for(int i=0;i<N;i++){ cin>>a[i]; } for(int i=0;i<N;i++){ for(int j=i;j<N;j++){ if(a[i]>a[j]){ swap(a[i],a[j]); c++; } } } cout<<c; return 0; }
标签:std,重组,cout,int,namespace,车厢,main From: https://www.cnblogs.com/As10016/p/17594380.html