1120 - I2P EECS 2016 Lab6 Scoreboard

Time

2017/01/04 09:00:00 2017/01/04 10:00:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
10895 Grade report(different order)
10945 Increasing linked list

10895 - Grade report(different order)   

Description

Given a grade report for all students in a class, which includes student ID, Chinese grade, English grade, math grade, and science grade for each student. Please list the report sorted in two different way.

If the order is descending, sort the grade by the total grade from high to low. If the total grade is the same between two students, then sort by order of Chinese grade, English grade, math grade, science grade, and student ID, which is from high to low for all grades and from low to high for student ID.

If the order is ascending, sort the grade by the total grade from low to high. If the total grade is the same between two students, then sort by order of Chinese grade, English grade, math grade, science grade, and student ID, which is from low to high for all grades and from low to high for student ID.

Note that in both two way, the student ID is sorted from low to high.

You need to store these information in structures:

typedef struct
{
   int ID;
   int Chinese, English, math, science;
   int total;
} Grade;

HINT

Hint: While sorting, you can use qsort in <stdlib.h> or write other sorting algorithms by your self.

function.h

main.c

Input

The first line contains an integer N and a string, which means the number of students in the class and the order which grade are sorting in respectively.

In the following N lines, there are 5 integers: student ID, Chinese grade, English grade, math grade, and science grade in each line in order, which are separate by spaces.

Output

List the sorted report, while each line contains student ID, total grade, Chinese grade, English grade, math grade, and science grade in order, where there is a '\t' between each number. Note that there is a '\n' at the end of each line.

Sample Input  Download

Sample Output  Download

Partial Judge Code

10895.c

Partial Judge Header

10895.h

Tags




Discuss




10945 - Increasing linked list   

Description

Given a link list structure named Node.

 

typedef struct _Node {

    int data;

    struct _Node *next;

} Node;

Use this structure to implement a increasing integer link list.

 

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

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.

main.c

function.h

Input

A non negative integer data per rows, if input is smaller then 0 then exit the while loop and exit the program.

Output

Please follow the output of program

Sample Input  Download

Sample Output  Download

Partial Judge Code

10945.c

Partial Judge Header

10945.h

Tags

10502HW1 10502HW 10402HW1 105那個分錯類了...



Discuss