B. 喜欢除法的 TooY0ung

    Type: Default 1000ms 256MiB

喜欢除法的 TooY0ung

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

题目描述

输入 nn 个整数 a1ana_1\sim a_n

TooY0ung 喜欢除法,他想要把每个数都除以对应的下标,但显然这不一定除得尽(本题中能除尽的定义为除法的余数为 00)。

好在 TooY0ung 还掌握了另一项技能,它可以执行若干次的 -1 操作,每次可以随意挑选一个数,将其减少 11

请问 TooY0ung 最少需要进行几次 -1 操作,才能让每个数除以对应的下标能除得尽。

输入格式

第一行一个整数 nn

第二行为 nn 个整数 a1ana_1\sim a_n

输出格式

一行一个整数,即答案。

3
5 1 10
2
6
100 100 100 100 100 100
5

样例解释

  • 样例 1:可以把三个数变成 5 0 9
  • 样例 2:可以把六个数变成 100 100 99 100 100 96

数据规模与约定

对于 100%100\% 的数据,1n,ai1061\le n,a_i\le 10^6

  • 子任务 1(30 分):保证 n=2n=2
  • 子任务 2(30 分):保证 1n,ai1001\le n,a_i\le 100
  • 子任务 3(40 分):没有特殊限制。

XAZXOI Round 12 - Level 3

Not Attended
Status
Done
Rule
IOI
Problem
4
Start at
2025-4-12 16:00
End at
2025-4-13 12:00
Duration
2 hour(s)
Host
Partic.
14