899 - I2P(I)2015_Yang_Lab_12 Scoreboard

Time

2015/12/31 13:25:00 2015/12/31 14:45:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
10880 Calculating calorie

10880 - Calculating calorie   

Description

Anne is on a diet now so she wants to eat the set with the lowest calorie. You will be given N sets(1<=N<50) which contains the calorie of salad, main course , drink and dessert then you need to calculate the set of the lowest calorie and tell Anne which set should she eats.(All the sets have different total calorie.)

You need to store these information in structures:

 

For example, if there are 2 set, the first set is Meatball Marinara and the calorie of salad is 235, main course is 560, drink is 250 and dessert is 380. The other set is Spicy Italian and the calorie of salad is 125, main course is 389, drink is 320 and dessert is 150. Because the total calorie of Meatball Marinara is 235+560+250+380 = 1425 and the total calorie of Spicy Italian is 125+389+320+150 = 984, you need to return the number of set, which is index 1 in menu array and print the name “SpicyItalian”.

 

Note that

1.      This problem involves three files.

  • function.h: Function definition of calorie.
  • function.c: Function implementation of calorie.
  • main.c: A driver program to test your implementation.

You will be provided with main.c and function.h, and asked to implement function.c.

2.     For OJ submission:

       Step 1. Submit only your function.c into the submission block. (Please choose c compiler) 

       Step 2. Check the results and debug your program if necessary.

 

 

Hints:

function.h

main.c

 

Input

The first is number of N sets. For each case, the first is the number of the set(number will be in order, like 1 2 3 4 5....). The second line is the name of the set. The third line is the calorie of salad, main course(means main in structure Set), drink and dessert.

Output

The name with the lowest calorie. Note that you don’t need to print “\n” at the end.

Sample Input  Download

Sample Output  Download

Partial Judge Code

10880.c

Partial Judge Header

10880.h

Tags

contest 10401Contest



Discuss