Saurabh and Array
CodeChefOpen on judge ↗
Saurabh formed an array by concatenating integers from **1 to n**, k times. Now he wants to know how many subarrays of any size are there such that sum of the subarray is **(n(n+1))/2**. ### Input The first line of the input is an integer t denoting the number of testcases. Then the ith line of the input contains two integers n and k (1 ≤ n ≤ 10^9, 1 ≤ k ≤ 10^9). ### Output Print t lines and in
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