提交时间:2022-07-20 12:57:34

运行 ID: 52993

#include<bits/stdc++.h> using namespace std; int ans; int n; int a[1000000]; int f; int l; int main() { cin >> n; f = n; for(int i=1; i<=n; i++) cin >> a[i]; for(int f=n; f>=1; f--) { int Max = -10000; for(int i=f-1; i>=1; i--) { if(a[i] > a[f]) { // cout << a[f] << " " << a[i] << endl; Max = a[i]; l = i; } } ans += f-l; } cout << ans << endl; return 0; }