HDOJ 5147 Sequence II 树阵
生活随笔
收集整理的這篇文章主要介紹了
HDOJ 5147 Sequence II 树阵
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
樹陣:
每個號碼的前面維修比其數數少,和大量的這后一種數比他的數字
再枚舉每一個位置組合一下?
Sequence II
Time Limit: 5000/2500 MS (Java/Others)????Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 121????Accepted Submission(s): 58
Problem Description Long long ago, there is a sequence A with length n. All numbers in this sequence is no smaller than 1 and no bigger than n, and all numbers are different in this sequence.
Please calculate how many quad (a,b,c,d) satisfy:
1.?1≤a<b<c<d≤n
2.?Aa<Ab
3.?Ac<Ad
Input The first line contains a single integer T, indicating the number of test cases.
Each test case begins with a line contains an integer n.
The next line follows n integers?A1,A2,…,An.
[Technical Specification]
1 <= T <= 100
1 <= n <= 50000
1 <=?Ai?<= n
Output For each case output one line contains a integer,the number of quad.
Sample Input 1 5 1 3 2 4 5
Sample Output 4
Source BestCoder Round #23
版權聲明:本文博客原創文章,博客,未經同意,不得轉載。
總結
以上是生活随笔為你收集整理的HDOJ 5147 Sequence II 树阵的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Python环境的安装
- 下一篇: Mongodb安装搭建Replica S