QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 256 MB Total points: 100

#3681. 模积和

Statistics

问题描述

求 $\sum\limits_{i=1}^n \sum\limits_{j=1}^m [i \ne j] (n \bmod i) (m \bmod j)$

输入格式

第一行两个数 $n,m$。

输出格式

一个整数表示答案 $\bmod 19\,940\,417$ 的值

样例输入

3 4

样例输出

1

样例说明

答案为 $\begin{split}(3 \bmod 1)\times(4 \bmod 2)+(3 \bmod 1) \times (4 \bmod 3)+(3 \bmod 1) \times (4 \bmod 4) + (3 \bmod 2) \times (4 \bmod 1) + (3 \bmod 2) \times (4 \bmod 3) +\\ (3 \bmod 2) \times (4 \bmod 4) + (3 \bmod 3) \times (4 \bmod 1) + (3 \bmod 3) \times (4 \bmod 2) + (3 \bmod 3) \times (4 \bmod 4) = 1\end{split}$

数据规模和约定

对于 $10\%$ 的数据 $n,m\leq 1\,000$;

对于 $30\%$ 的数据 $n,m \leq 1\,000\,000$;

另有 $30\%$ 的数据 $n \leq 100$,$m \leq 10^9$;

对于 $100\%$ 的数据 $n,m \leq 10^9$。

Discussions

About Discussions

The discussion section is only for posting: Editorials, General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues. Submitting multiple issues may cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.