• [B] range_sum(middum)

  • 时间限制: 2000 ms 内存限制: 65535 K
  • 问题描述
  • 你听说过 oo + oo = oo 吗?(请把oo当作无穷符号,^_^)

    假设有一个无穷个房间的旅馆,来了一辆装着无穷多人的客车,问旅馆能否住的下新来的旅客?

    做法很简单,只要已经住下的第 i 个房间的客人搬到第 2i 个房间,那么 i 号房间就能空出来,给新来的旅客住.

    所以 无穷 + 无穷 = 无穷, 即 oo + oo = oo

    =========================冷酷的中英文分割线=========================

    There are cells in a line, every cell have some stars, the ith position contains a[i] stars.

    A rabbit in position can jump from x to 2*x , and he will collect the stars he has travelled

    The number of cells is 2*n, you are asked to calculate how many star will a rabbit collects jump from 1, 2, 3... n

    A rabbit only jump once
  • 输入
  • the first line, number of cases T
    in eyery case:
    first line: an integer n stands for the starts to choose(1<=n<=5*10^4)
    second line: 2*n integers stand for the cells a[1], a[2], a[3]... a[2*n], (0<=a[i]<=10^9)
  • 输出
  • in every case print n numbers
    the ith is the stars a rabbit jump from x to 2*x
  • 样例输入
  • 2
    3
    1 2 3 4 5 6
    2
    2 2 3 3
    
  • 样例输出
  • 3 9 18
    4 8
    
  • 提示
  • the first case:
    jump from 1 -> 2: 1 + 2 = 3
    jump from 2 -> 4: 2 + 3 + 4 = 9
    jump from 3 -> 6: 3 + 4 + 5 + 6 = 18
  • 来源
  • by k_arthur4
  • 操作

显示春菜