代码:
#include<bits/stdc++.h>
using namespace std;
int a[110];
int main(){
int n,q;
cin >> n;
for(int i = 1;i <= n;i++){
cin >> a[i];
}
cin >> q;
for(int i = 1;i <= q;i++){
int l,r;
cin >> l >> r;
for(int k = l+1;k <= r;k++){
if (a[k] < a[k - 1]){
int temp = a[k];
a[k] = a[k - 1];
a[k - 1] = temp;
}
}
}
for(int i = 1;i <= n;i++){
cout << a[i] << " ";
}
return 0;
}
不太会格式o(╥﹏╥)o