70分求助
查看原帖
70分求助
791994
liyanchenlycccccc楼主2023/9/9 22:05
#include <bits/stdc++.h>
using namespace std;
long long n,a[1000010];
int main()
{
  cin>>n;
  int t=-1;
  int m=1e18;
  for(int i=1; i<=n; i++)
  {
    cin>>a[i];
    if(a[i]>t) t=a[i];
    if(a[i]<m) m=a[i];
  }
  for(int i=1; i<=n; i++)
  {
    if(t==a[i]) cout<<0<<" ";
    else cout<<t-a[i]<<" ";
  }
  cout<<endl;
  for(int i=1; i<=n; i++)
  {
    if(a[i]==m) cout<<0<<" ";
    else cout<<a[i]-m<<" ";
  }
  return 0;
}
2023/9/9 22:05
加载中...