Problem p00054 - Generation 1

Orig Description

Sum of Decimal Digits
Let a, b, and n be positive integers. Let f(i) be the i-th digit (0 ≤ f(i) ≤ 9) of the decimal expansion of the fraction a / b. Define the sum s as the sum of the first n digits:
s = f(1) + f(2) + ... + f(n)
Write a program that reads a, b, and n, and outputs s.
Input
The input consists of multiple datasets. Each dataset consists of three integers a (1 ≤ a ≤ 1000), b (1 ≤ b ≤ 10000), and n (1 ≤ n ≤ 100), separated by a single space, on a line.
There are no more than 100 datasets.
Output
For each dataset, output s on a line.
Sample Input
1 2 3
2 3 4
5 4 3
4 3 2
Output for the Sample Input
5
24
7
6

Extracted Specification

Canonicalized Input Description:

A set of multiple datasets. Each dataset consists of three integers.

- An integer a (1 ≤ a ≤ 1000)
- An integer b (1 ≤ b ≤ 10000)
- An integer n (1 ≤ n ≤ 100)

There are no more than 100 datasets.

### Example Input:

```
1 2 3
2 3 4
5 4 3
4 3 2
```

### Function Signature:
Write a function f(inputs) that takes in the input.
```python
def f(inputs: List[Tuple[int, int, int]]):
    '''
    inputs: a list of tuples, where each tuple contains three integers
    '''
```

Test Case Generator

Sure, I can help you write a test case generator for the "Sum of Decimal Digits" problem. Below is the implementation of the generator:

```python
import random

def tcgen():
    datasets = []
    num_datasets = random.randint(1, 100)
    
    for _ in range(num_datasets):
        a = random.randint(1, 1000)
        b = random.randint(1, 10000)
        n = random.randint(1, 100)
        datasets.append((a, b, n))
    
    return datasets

def print_test_cases(datasets):
    for a, b, n in datasets:
        print(f"{a} {b} {n}")

# Generate and print test cases
datasets = tcgen()
print_test_cases(datasets)
```

### Explanation of the Test Case Generator:

1. **`tcgen()` Function**:
   - Generates a random number of datasets (between 1 and 100).
   - For each dataset, it randomly selects values for `a` (1 to 1000), `b` (1 to 10000), and `n` (1 to 100).
   - Stores each dataset as a tuple `(a, b, n)` in a list `datasets`.
   - Returns the list `datasets`.

2. **`print_test_cases()` Function**:
   - Accepts the list of datasets.
   - Prints each dataset in the required format.

3. **Usage**:
   - The function `tcgen()` is called to generate random datasets.
   - The `print_test_cases()` function is called with the generated datasets to print them in the required format.

You can run this script to generate a random set of test cases for the "Sum of Decimal Digits" problem. Each time you run it, you will get a different set of test cases.

Extract Arguments

def extract_arguments(fh):
    inputs = []
    for line in fh:
        a, b, n = map(int, line.strip().split())
        inputs.append((a, b, n))
    return inputs