佬们帮忙看看吧求求了

#include <bits/stdc++.h>
using namespace std;

int main() 
{
	int n , a;
	cin >> n;
	int num[10000];
	for (int i = 0 ; i < n ; i ++)
	{
		cin >> a;
		num[i] = a;
	}
	int m;
	cin >> m;
	int x , y;
	for(int i = 0 ; i < m ; i ++)
	{
		for (int i = 0 ; i < n ; i ++)
		{	
			cout << num[i];
			cout << " ";
		}
		cin >> x >> y;
		for(int ii = n ; ii > x ; ii --)
		{
			num[ii] = num[ii - 1];
		}
		num[x] = y;
		n = n + 1;	
	}
	for (int i = 0 ; i < n ; i ++)
	{
		cout << num[i];
		cout << " ";
	}

}

1 comments

  • 1

Information

ID
588
Time
1000ms
Memory
256MiB
Difficulty
4
Tags
# Submissions
128
Accepted
56
Uploaded By