No.3106 Simple Math Problem 3
問題文最終更新日: 2025-04-11 21:20:43
English (AI translation)
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence.
Back to the original
yukicoder contest 464
(順位表)
の他の問題:
Problem Statement
You are given a positive integer $N$. Find the sum of the values of $A \bmod B$ over all pairs of positive integers $A, B$ satisfying both of the following $2$ conditions, modulo $998244353$.
- $1 \le A \le N$
- $B \times (A \bmod B) < A$
Here, $A \bmod B$ denotes the remainder when $A$ is divided by $B$ (a value at least $0$ and less than $B$).
Constraints
- $1 \le N \le 10^{12}$
- $N$ is an integer.
Input
$N$
Output
Output the answer.Sample
Sample 1
Input
5
Output
4
The following $14$ pairs $(A, B)$ satisfy the conditions.
- $(A,B) = (1,1)$ … $A \bmod B = 0$
- $(A,B) = (2,1)$ … $A \bmod B = 0$
- $(A,B) = (2,2)$ … $A \bmod B = 0$
- $(A,B) = (3,1)$ … $A \bmod B = 0$
- $(A,B) = (3,2)$ … $A \bmod B = 1$
- $(A,B) = (3,3)$ … $A \bmod B = 0$
- $(A,B) = (4,1)$ … $A \bmod B = 0$
- $(A,B) = (4,2)$ … $A \bmod B = 0$
- $(A,B) = (4,3)$ … $A \bmod B = 1$
- $(A,B) = (4,4)$ … $A \bmod B = 0$
- $(A,B) = (5,1)$ … $A \bmod B = 0$
- $(A,B) = (5,2)$ … $A \bmod B = 1$
- $(A,B) = (5,4)$ … $A \bmod B = 1$
- $(A,B) = (5,5)$ … $A \bmod B = 0$
The sum of these values of $A \bmod B$ is $4$, so output $4$.
Sample 2
Input
2
Output
0
Sample 3
Input
2025
Output
1005189
Sample 4
Input
314159265358
Output
783124332
The sum of the values of $A \bmod B$ is $24673971873667135333427$, so output $783124332$, which is its remainder modulo $998244353$.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
noya2