問題一覧 > 通常問題

No.3106 Simple Math Problem 3

レベル : / AI推定難易度 : 2225 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 11
作問者 : shobonvip / テスター : noya2
お気に入りにしたユーザー ProblemId : 11563 / 自分の提出
問題文最終更新日: 2025-04-11 21:20:43
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もしくは右上の雲マークをクリックしてアカウントを作成してください。