Problem p00311 - Generation 3

Orig Description

Fishing Competition
Brothers Hiroshi and Kenjiro came to Lake Inawashiro to go fishing. They decided to compete against each other by assigning points to the fish they caught and adding up the total points.
One iwana is worth a points.
One yamame is worth b points.
Every 10 iwana caught is worth an additional c points.
Every 20 yamame caught is worth an additional d points.
Write a program to determine who won the competition, or if it is a tie, based on the number of fish caught by each person.
Input
The input is given in the following format:
h1 h2
k1 k2
a b c d
The first line contains the number of iwana h1 (0 ≤ h1 ≤ 100) and yamame h2 (0 ≤ h2 ≤ 100) caught by Hiroshi. The second line contains the number of iwana k1 (0 ≤ k1 ≤ 100) and yamame k2 (0 ≤ k2 ≤ 100) caught by Kenjiro. The third line contains the points assigned to one iwana a (1 ≤ a ≤ 100), one yamame b (1 ≤ b ≤ 100), the additional points awarded for every 10 iwana caught c (0 ≤ c ≤ 100), and the additional points awarded for every 20 yamame caught d (0 ≤ d ≤ 100).
Output
Output hiroshi if Hiroshi wins, kenjiro if Kenjiro wins, or even if it is a tie.
Sample Input 1
5 1
3 1
1 2 5 5
Sample Output 1
hiroshi
Sample Input 2
5 1
4 2
1 2 5 5
Sample Output 2
kenjiro
Sample Input 3
0 20
10 0
1 1 10 0
Sample Output 3
even

Extracted Specification

An integer h1 (0 ≤ h1 ≤ 100) and an integer h2 (0 ≤ h2 ≤ 100).
An integer k1 (0 ≤ k1 ≤ 100) and an integer k2 (0 ≤ k2 ≤ 100).
An integer a (1 ≤ a ≤ 100), an integer b (1 ≤ b ≤ 100), an integer c (0 ≤ c ≤ 100), and an integer d (0 ≤ d ≤ 100).

### Example Input:

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

### Function Signature:
Write a function f(h1, h2, k1, k2, a, b, c, d) that takes in the input.
def f(h1: int, h2: int, k1: int, k2: int, a: int, b: int, c: int, d: int):
    ''' 
    h1: an integer 
    h2: an integer
    k1: an integer
    k2: an integer
    a: an integer
    b: an integer
    c: an integer
    d: an integer
    '''

Test Case Generator

Sure! Below is a Python function to generate test cases for the "Fishing Competition" problem. The function `tcgen` will generate random test cases based on the constraints provided in the problem statement.

```python
import random

def tcgen():
    # Generate random values for the number of iwana and yamame caught by Hiroshi
    h1 = random.randint(0, 100)
    h2 = random.randint(0, 100)
    
    # Generate random values for the number of iwana and yamame caught by Kenjiro
    k1 = random.randint(0, 100)
    k2 = random.randint(0, 100)
    
    # Generate random values for the points and additional points
    a = random.randint(1, 100)
    b = random.randint(1, 100)
    c = random.randint(0, 100)
    d = random.randint(0, 100)

    # Generate the input as a tuple
    input_data = (h1, h2, k1, k2, a, b, c, d)
    
    return input_data

# Example usage
if __name__ == "__main__":
    test_case = tcgen()
    h1, h2, k1, k2, a, b, c, d = test_case
    print(f"{h1} {h2}")
    print(f"{k1} {k2}")
    print(f"{a} {b} {c} {d}")
```

To use the `tcgen` function, simply call it and it will return a tuple containing randomly generated values for one test case. The example usage at the bottom demonstrates how you can print the generated test case in the required format.

This function ensures that all constraints provided in the problem statement are met:
- The number of fish caught by each person is between 0 and 100.
- The points for each fish and additional points are within their specified ranges.

Extract Arguments

def extract_arguments(fh):
    h1, h2 = map(int, fh.readline().strip().split())
    k1, k2 = map(int, fh.readline().strip().split())
    a, b, c, d = map(int, fh.readline().strip().split())
    return (h1, h2), (k1, k2), (a, b, c, d)