点击这里查看原题
水题
/*
User:Small
Language:C++
Problem No.:1660
*/
#include<bits/stdc++.h>
#define ll long long
#define inf 999999999
using namespace std;
const int M=8e4+5;
int n,c[M],s[M],tp;
ll ans;
int main(){
freopen("data.in","r",stdin);//
scanf("%d",&n);
for(int i=1;i<=n;i++)
scanf("%d",&c[i]);
for(int i=1;i<=n;i++){
while(tp&&s[tp]<=c[i]) tp--;
ans+=tp;
s[++tp]=c[i];
}
printf("%lld\n",ans);
return 0;
}

这是一个使用C++解决特定问题的程序示例。通过一系列算法和数据结构操作,该程序能够高效地处理并解决问题。代码中使用了标准模板库,并定义了一些关键变量来存储和操作数据。
338

被折叠的 条评论
为什么被折叠?



