#abc230g. G - GCD Permutation
G - GCD Permutation
Score : points
问题描述
给定一个从 到 的整数排列 。
找出满足以下条件的整数对 的数量:,且 以及 。
这里,对于正整数 和 , 表示 和 的最大公约数。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
Given is a permutation of the integers from through .
Find the number of pairs of integers such that satisfying and .
Here, for positive integers and , denotes the greatest common divisor of and .
Constraints
- is a permutation of .
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
6
5 1 3 2 4 6
Sample Output 1
6
Six pairs , , , , , satisfy the condition, so should be printed.
Sample Input 2
12
1 2 3 4 5 6 7 8 9 10 11 12
Sample Output 2
32
update @ 2024/3/10 10:04:00