Universal Cup Judging System

Universal Cup

Time Limit: 1.0 s Memory Limit: 1024 MB Total points: 100 Hackable ✓
Statistics

ให้ $f(n, k)$ เป็นจำนวนของคู่ลำดับของจำนวนเต็ม $(a, b)$ ที่สอดคล้องกับ:

  • $0 \le a, b < n$
  • $k(a + b) \equiv ab \pmod n$

กำหนดจำนวนเต็มสองตัว $n$ และ $m$ คุณต้องคำนวณ

$$\sum_{k=0}^{m} f(n, k)$$

เนื่องจากคำตอบอาจมีค่ามาก ให้แสดงผลลัพธ์มอดูโล $998\,244\,353$

ข้อมูลนำเข้า

มีหลายชุดทดสอบ บรรทัดแรกของข้อมูลนำเข้าประกอบด้วยจำนวนเต็ม $T$ ($1 \le T \le 10^4$) แสดงจำนวนชุดทดสอบ สำหรับแต่ละชุดทดสอบ:

บรรทัดเดียวประกอบด้วยจำนวนเต็มสองตัว $n$ และ $m$ ($1 \le n \le 10^{14}, 0 \le m < n$)

รับประกันว่ามีชุดทดสอบอย่างมาก $10$ ชุดที่มีค่า $n$ มากกว่า $10^8$

ข้อมูลส่งออก

สำหรับแต่ละชุดทดสอบ ให้ส่งออกหนึ่งบรรทัดที่ประกอบด้วยจำนวนเต็มหนึ่งตัว แสดงคำตอบมอดูโล $998\,244\,353$

ตัวอย่าง

ข้อมูลนำเข้า 1

4
7 2
100 15
202604 11
1145141 919810

ข้อมูลส่งออก 1

25
2500
3444208
165721266

Discussions

About Discussions

The discussion section is only for posting: 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.
  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.