比赛 |
20121109 |
评测结果 |
WAWWWWTTTT |
题目名称 |
三元数对 |
最终得分 |
10 |
用户昵称 |
苏轼 |
运行时间 |
4.079 s |
代码语言 |
C++ |
内存使用 |
3.61 MiB |
提交时间 |
2012-11-09 10:29:17 |
显示代码纯文本
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
unsigned long long n,w[30005]={0},q[30005]={0},answer=0;
int main()
{
freopen ("three.in","r",stdin);
freopen ("three.out","w",stdout);
cin>>n;
for (int i=1;i<=n;i++)
{
cin>>w[i];
for (int j=1;j<i;j++)
{
if (w[j]<w[i])
q[i]++;
}
}
for (int i=3;i<=n;i++)
{
for (int j=1;j<n;j++)
{
if (q[j]>0&&w[j]<w[i])
{
answer+=q[j];
}
}
}
cout<<answer;
return 0;
}