1、题目:

算法与数据结构实验题 2.2 逆序数

2、代码:

#include<iostream>
using namespace std;
int main()
{
	int n;
	int a[501];
	cin>>n;
	int i,j,l;
	int result[501];
	for(i=0;i<n;i++)
	{
		cin>>a[i];
		result[i]=i+1;
	}	
	for(i=0;i<n;i++)
	{
		cout<<result[a[i]]<<" ";
		for(j=a[i];j<n-1;j++)
		{
			result[j]=result[j+1];
		}
	}
	cout<<endl;
	return 0;
}

相关文章:

  • 2021-05-16
  • 2022-02-05
  • 2021-06-24
  • 2021-06-29
  • 2021-10-04
  • 2021-06-15
  • 2021-06-23
  • 2021-05-17
猜你喜欢
  • 2022-01-26
  • 2021-08-09
  • 2022-12-23
  • 2021-09-15
  • 2021-10-04
  • 2021-08-28
相关资源
相似解决方案