CF1553F.Pairwise Modulo
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
You have an array a consisting of n distinct positive integers, numbered from 1 to n . Define pk as $$$$p_k = \sum_{1 \le i, j \le k} a_i \bmod a_j, $$ where xbmody denotes the remainder when x is divided by y . You have to find and print p_1,p_2,ldots,p_n$$.
输入格式
The first line contains n — the length of the array ( 2≤n≤2⋅105 ).
The second line contains n space-separated distinct integers a1,…,an ( 1≤ai≤3⋅105 , ai=aj if i=j ).
输出格式
Print n integers p1,p2,…,pn .
输入输出样例
输入#1
4 6 2 7 3
输出#1
0 2 12 22
输入#2
3 3 2 1
输出#2
0 3 5