luogu#P2260. [清华集训 2012] 模积和

    ID: 1243 远端评测题 1000ms 125MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>数学2012CTT(清华集训/北大集训)整除分块

[清华集训 2012] 模积和

Background

{{A mathematics problem, no background.}}

Problem Description

{{Compute

$$\sum_{i=1}^{n} \sum_{j=1}^{m} (n \bmod i) \times (m \bmod j), i \neq j$$

the value modulo 19940417.}}

Input Format

{{The input contains a single line with two integers nn, mm.}}

Output Format

{{The answer modulo 19940417.}}

3 4
1
123456 654321
116430

Hint

{{Constraints

  • For 10% of the testdata, it is guaranteed that n,m103n, m \le 10^3.
  • For 30% of the testdata, it is guaranteed that n,m106n, m \le 10^6.
  • For another 30% of the testdata, it is guaranteed that n100n \le 100.
  • For 100% of the testdata, it is guaranteed that 1n,m1091 \le n, m \le 10^9.}}

Translated by ChatGPT 5