Just a simple sum
Given n and m, calculate 11 + 22 + 33 + ... + nn modulo m. Input The first line contains 1 ≤ t ≤ 10, the number of test cases. Then the test case definitions follow. Each test case is of the form: 1 ≤ n 1018, 1 ≤ m ≤ 200000 Output For each test case simply write a single line containing the answer to the problem. ### Sample Test Cases **Sample 1** Input: ``` 6 1 100000 2 100000 3 100000 4 100
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start