14152 - TsingHua Arena   

Description

Because National Tsing Hua University is the number 1 university in Taiwan (citation needed) there is a lot of people that want to apply. The number of people that want to apply can be in the thousands but NTHU does not have space for all of them. Usually, the university would go through many applicant's papers but in the year of 20XX, a student suggested that the university perform an arena-based selection.

How it works is that the university will separate applicant to batches and the applicants will fight until there is only one left standing. Each applicant has their own stats (name, health, strength, magic, defense, resistance, and attack type). They will also be assigned an index.

The rules are that each applicant must attack the applicant in the next index, for example the applicant with the index 0 must attack the applicant with index 1 while the applicant with the index 22 will attack the applicant with index 23. In the scenario that there is 50 applicants, the applicant with index 49 will attack the applicant with index 0. 

If a certain applicant's health is reduced to 0 or lower, they will be disqualified and they will be skipped (e.g. if the applicant at index 2 is disqualified, the applicant in index 1 will attack the applicant in index 3).

Each applicant will attack using their own attack type. If their attack type is physical then they will use their strength value to deal damage. If their attack is magical then they will use their magic value to deal damage. The applicant under attack can negate the attack values by with their defense stat for physical attacks and resistance stat for magical attacks.

The battle will go on until there is one person left standing, who will be crowned the winner and be accepted in National Tsing Hua University.

To make this idea come to fruition, a simulated prototype is made which requires 4 functions which you need to code:

1. void magicalAttack(struct Contestant* self, struct Contestant* target); (used to calculate and deal magical damage)

2. void physicalAttack(struct Contestant* self, struct Contestant* target); (used to calculate and deal magical damage)

3. void getContestants(struct Contestant* contestants, int len); (scan and create the contestant list)

4. int findTarget(struct Contestant* contestants, int idx, int len); (find the target of the current contestant)

 

Input

The first line contains the value of N, the number of contestants in the batch (0 <= N <= 100).

The following N lines contains 7 values for each contestant: (the contestants are already sorted based on their index)

name - health - strength - magic - defense - resistance - attack type

For the string values (name and attack type), their length will be 0 <= len <= 15

for the numerical values, their value will be 0 <= val <= 100

Output

Write down the name of the contestant followed by "wins the tournament" followed by a newline character. For example:

Bill wins the tournament

 

Sample Input  Download

Sample Output  Download

Partial Judge Code

14152.c

Partial Judge Header

14152.h

Tags




Discuss