提交时间:2023-11-04 11:32:14
运行 ID: 108900
#include<bits/stdc++.h> using namespace std; int n; int a[50001],b[50001],c[50001]; int main() { int l=1; do { cin>>n; if(n==0) break; for(int i=1;i<=n;i++) cin>>a[i]; int i=0,nn=n;; while(n-l!=1) { sort(a+l,a+1+nn); l+=2; b[i++]=a[n-1]*a[n]+1; c[i]=a[1]*a[2]+1; n++; } cout<<c[i]-b[i]<<endl; }while(n!=0); return 0; }