102543: [AtCoder]ABC254 D - Together Square
Memory Limit:256 MB
Time Limit:2 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Score : $400$ points
Problem Statement
You are given an integer $N$. Find the number of pairs $(i,j)$ of positive integers at most $N$ that satisfy the following condition:
- $i \times j$ is a square number.
Constraints
- $1 \le N \le 2 \times 10^5$
- $N$ is an integer.
Input
Input is given from Standard Input in the following format:
$N$
Output
Print the answer.
Sample Input 1
4
Sample Output 1
6
The six pairs $(1,1),(1,4),(2,2),(3,3),(4,1),(4,4)$ satisfy the condition.
On the other hand, $(2,3)$ does not, since $2 \times 3 =6$ is not a square number.
Sample Input 2
254
Sample Output 2
896
Input
题意翻译
给定 $ n $,求满足以下条件的二元组 $ (i, j) $ 数量:$ 1 \le i, j \le n, i \times j = k^2(k \in \mathbb{N}^*) $。Output
分数:400分
问题描述
给你一个整数$N$。找出所有满足以下条件的正整数对$(i,j)$:
- $i \times j$是一个平方数。
约束条件
- $1 \le N \le 2 \times 10^5$
- $N$是一个整数。
输入
输入通过标准输入给出以下格式:
$N$
输出
打印答案。
样例输入1
4
样例输出1
6
满足条件的六对数对$(1,1),(1,4),(2,2),(3,3),(4,1),(4,4)$。
另一方面,$(2,3)$不满足条件,因为$2 \times 3 =6$不是一个平方数。
样例输入2
254
样例输出2
896