#P16322. 【MX-J29-T1】数字划分

【MX-J29-T1】数字划分

Problem Description

Given a number mm with length nn, you need to output how mm looks if you insert a comma every kk digits when grouping from the lowest digit to the highest digit.

Input Format

This problem has multiple test cases. The first line contains two positive integers c,tc, t, representing the Subtask ID and the number of testdata groups. In particular, in the samples c=0c = 0.

For each testdata group:

  • Input one line with three positive integers n,m,kn, m, k.

Output Format

For each testdata group:

  • Output one line containing a string representing your answer.
0 2
13 1145141919810 3
10 1114561523 4
1,145,141,919,810
11,1456,1523

Hint

Sample Explanation

For the first group of data, simulating as required gives the split number string 1,145,141,919,810.

For the second group of data, simulating as required gives the split number string 11,1456,1523.

Constraints

For all data, it is guaranteed that:

  • 1t1051 \le t \le 10^5;
  • 1k<n1061 \le k < n \le 10^6;
  • n106\sum n \le 10^6;
  • 10nm<10n+110^n \le m < 10^{n+1}.

This problem uses bundled tests, and each subtask has the following special properties:

::cute-table{tuack} | Subtask | n\sum n \le | Special Property | Score | |:-:|:-:|:-:|:-:| | 11 | 10310^3 | None | 4040 | | 22 | 10610^6 | knk \mid n | 4040 | | 33 | ^ | None | 2020 |

Translated by ChatGPT 5