码迷,mamicode.com
首页 > 编程语言 > 详细

(树状数组) HOJ 2275

时间:2015-01-28 21:03:37      阅读:223      评论:0      收藏:0      [点我收藏+]

标签:

Number sequence

My Tags   (Edit)
  Source : SCU Programming Contest 2006 Final
  Time limit : 1 sec   Memory limit : 64 M

Submitted : 1598, Accepted : 432

Given a number sequence which has N element(s), please calculate the number of different collocation for three number Ai, Aj, Ak, which satisfy that Ai < Aj > Ak and i < j < k.

Input

The first line is an integer N (N <= 50000). The second line contains N integer(s): A1, A2, ..., An(0 <= Ai <= 32768).

Output

There is only one number, which is the the number of different collocation.

Sample Input
5
1 2 3 4 1
Sample Output
6

(树状数组) HOJ 2275

标签:

原文地址:http://www.cnblogs.com/a972290869/p/4256822.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!