#P10670. BZOJ4174 tty 的求助

BZOJ4174 tty 的求助

Problem Description

Compute the value of the following expression modulo 998244353998244353, where xx is a real number and all other variables involved are integers:

$$\sum_{n=1}^N \sum_{m=1}^M \sum_{k=0}^{m-1} \lfloor \dfrac{nk+x}{m}\rfloor$$

Input Format

Input one line containing two positive integers N,MN, M and one real number xx.

Output Format

Output one line containing one integer, representing the answer modulo 998244353998244353.

2 3 1 
7

Hint

Constraints: 1N,M5000001\leq N, M\leq 500000, 0<x1000000<x\leq 100000. The value of xx is given accurate to 88 digits after the decimal point.

Translated by ChatGPT 5