• [1630] VectorMultiply

  • 时间限制: 1000 ms 内存限制: 65535 K
  • 问题描述
  • There are two vector A(x1, x2, x3, ..., xn) and B(y1, y2, ..., yn), and the dot product(点积) is x1*y1 + x2*y2 + ... + xn*yn.
    You can swap the order of any dimension, for example, A = {1, 2, 3}, then you can make A to {1, 3, 2} or {2, 1, 3} and so on.
    Now you need to calculate the maximum value of dot product.

  • 输入
  • Input starts with an integer T (T <= 20)denoting the test case.
    For each test case, first line contains n(n <= 10000)
    then two lines follow, each line contains n integers(1 <= xi, yi <= 100000).
  • 输出
  • For each test case, print the maximum value of dot product.
  • 样例输入
  • 1
    4
    1 3 2 10
    2 3 4 1
  • 样例输出
  • 54
  • 提示
  • 来源
  • Alex@NBUT
  • 操作

显示春菜