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.
有给定的一个数组A[i]有N个数,请计算出满足(1):系数i < j < k.(2):Ai < Aj > Ak.请算出有多少种这样的组合的三个数?
Input
The first line is an integer N (N <= 50000). The second line contains N integer(s): A1, A2, ..., An(0 <= Ai <= 32768).
首先输入N,第2行输入N个int,
Output
There is only one number, which is the the number of different collocation.
输出一个NUM,是一共有多少中不同的组合.
Sample Input
5
1 2 3 4 1
例如:
1 2 1
131
234
124
^^^^^^
Sample Output
6
----------------解决方案--------------------------------------------------------
Wrong Answer超时到没有!但是还是错了!
----------------解决方案--------------------------------------------------------
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.
有给定的一个数组A[i]有N个数,请计算出满足(1):系数i < j < k.(2):Ai < Aj > Ak.请算出有多少种这样的组合的三个数?
Input
The first line is an integer N (N <= 50000). The second line contains N integer(s): A1, A2, ..., An(0 <= Ai <= 32768).
首先输入N,第2行输入N个int,
Output
There is only one number, which is the the number of different collocation.
输出一个NUM,是一共有多少中不同的组合.
Sample Input
5
1 2 3 4 1
例如:
1 2 1
131
234
124
^^^^^^
Sample Output
6
好像应该是121、131、231、141、241、341。这6个!
----------------解决方案--------------------------------------------------------
Wrong Answer超时到没有!但是还是错了!
连这样的都也会错.
----------------解决方案--------------------------------------------------------
全部改成long试下.
----------------解决方案--------------------------------------------------------
这我也试过了!真不知道是为什么呀!
----------------解决方案--------------------------------------------------------
http://acm.hit.edu.cn/ojs/show.php?Proid=2275&Contestid=0这是那个网址!
----------------解决方案--------------------------------------------------------
你的程序没有错误,其实只要#define N 40000就可以,应该是那个测评程序的问题
或者是你给的题目不是原题,否则就是我们都理解错了
----------------解决方案--------------------------------------------------------
不应该啊!我感觉没有理解错啊!那个网站也没有听说有错误啊!
----------------解决方案--------------------------------------------------------
那是不是输出格式或类型错了?比如它要的是文件输出等?
----------------解决方案--------------------------------------------------------