CF1553F.Pairwise Modulo

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

You have an array aa consisting of nn distinct positive integers, numbered from 11 to nn . Define pkp_k as $$$$p_k = \sum_{1 \le i, j \le k} a_i \bmod a_j, $$ where xbmodyx \\bmod y denotes the remainder when xx is divided by yy . You have to find and print p_1,p_2,ldots,p_np\_1, p\_2, \\ldots, p\_n$$.

输入格式

The first line contains nn — the length of the array ( 2n21052 \le n \le 2 \cdot 10^5 ).

The second line contains nn space-separated distinct integers a1,,ana_1, \ldots, a_n ( 1ai31051 \le a_i \le 3 \cdot 10^5 , aiaja_i \neq a_j if iji \neq j ).

输出格式

Print nn integers p1,p2,,pnp_1, p_2, \ldots, p_n .

输入输出样例

  • 输入#1

    4
    6 2 7 3

    输出#1

    0 2 12 22
  • 输入#2

    3
    3 2 1

    输出#2

    0 3 5
首页