CF1553F.Pairwise Modulo
提高+/省选-
通过率:0%
时间限制:4.00s
内存限制:256MB
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 xmody denotes the remainder when x is divided by y. You have to find and print p1,p2,…,pn.
你有一个由 n 个互不相同的正整数组成的数组 a,其元素编号从 1 到 n。定义 pk 为
p_k=sum_1lei,jleka_ibmoda_j,
其中 xmody 表示 x 除以 y 所得的余数。你需要求出并输出 p1,p2,…,pn。
输入格式
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).
第一行包含 n —— 数组的长度(2≤n≤2⋅105)。
第二行包含 n 个用空格分隔的互不相同的整数 a1,…,an(1≤ai≤3⋅105,当 i=j 时,ai=aj)。
输出格式
Print n integers p1,p2,…,pn.
输出 n 个整数 p1,p2,…,pn。
输入输出样例
输入#1
4 6 2 7 3
输出#1
0 2 12 22
输入#2
3 3 2 1
输出#2
0 3 5
输入解题思路,AI测评打分。不知道怎么写?