Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Thammasat Science Sports Day ( CstuSportsFest ) Semester 2 , academic year 2 0 2 0 , Thammasat University By Khanajarn Wicha K . P

Thammasat Science Sports Day (CstuSportsFest)
Semester 2, academic year 2020, Thammasat University
By Khanajarn Wicha K.P.300
In the year 3000, the Department of Computer Science, Thammasat University, will organize a sports day. For each color, the color supervisor must select 2 athletes of each color to compete in the programming sport. The selection will be considered. "Incompatibility" of the two athletes This mismatch is defined by the similarity of student characteristics. The characteristics of each student are measured by giving. Students answer a number of questionnaires/items. Each question will be given a score of 1,2,3,4, or 5.
For example, if a faculty member determines to use a questionnaire with 2 questions as follows:
(1) Do students like to eat Japanese food?
[1]
[2]
[3]
[4]
[5]
(2) Do students like to exercise or not?
[1]
[2]
[3]
[4]
[5]
And there were 3 students who answered the questionnaire and the details are as follows.
Student 1 rated item 1 as 3 and rated item 2 as 1.
Student 2 rated item 1 as 1 and rated item 2 as 5.
Student 3 rated Item 1 as 4 and rated Item 2 as 4.
From the query we can use a vector (1D array of size N).
vi = v1,v2,v3,.....,vn
To represent the questionnaire responses of the i-th student, the member in the vector vi is the score that the student answered in questionnaire number 1. As in the example above, we get that
Student 1 is represented by v1=[3,1]
Student 2 is represented by v2=[2,5],
Student number 3 is represented by v3=[4,4],
From this feature vector, we can find the mismatch of two students v1, v2 with the power of Euclidean distance of 2 as follows: Dv1,v2= zigma(v1-v2), where the higher the values of Dv1,v2, A high value means that the two students do not get along well. While the higher the value of Dv1,v2, the smaller the value means These two students are more likely to get along with each other.
Substituting the values, we can find Dv1, v2=(31)^2+(15)^2=4+16=20
and Dv1,v3,=(34)^2+(14)^2=1+9=10
When Dv1,v2> Dv1,v3, it means that Student 1 is more compatible with Student 3 than Student 2 because of their scores. The incompatibility scores of students 1 and 3 were less than the incompatibility scores of students 1 and 2.
And when we calculated Dv2,v3=(24)^2+(54)^2=4+1=5, it was found that students 2 and 3 had the lowest incompatibility scores. That is, students 2 and 3 are most compatible with each other. Students 2 and 3 were therefore selected to compete.
sports day
Problems
Have students write a program to help teachers of each color select 2 students by calculating the lowest incompatibility score. So that the two students who will be selected will be as compatible as possible. From a total of M students to participate in the writing competition. The program for the Thammasat Science and Technology Sports Festival 2000 follows the criteria above. (Assume that all students answer the questionnaire. has been completed) with details of the input and output of the program as follows:
Observations/Hints: If you want the program to be able to calculate values correctly. The program must check every possible pair of students. For example, if there are a total of 3 students in a color, the program must check all 3 pairs of students (1,2),(1,3), and (2,3) similar to what was calculated. Calculating from the example above, in the case where there are 4 students, the program must check all 6 pairs of students (1,2)(1,3)(1,4)(2,3)(2,4)(3,4)
input data
The input data has M +1 lines, where M is the total number of students participating in the selection.
Line 1, integer 2, number M and N, where N is the number of questionnaire items to measure student incompatibility, where 2<= M <=10 and 1<= N <=15.
Lines 2 through M +1 each take an integer N. The numbers tell details about responses to queries 1 through N, with each value being an integer in the range 1 through 5.
Note: All input data must always have the correct value according to the format, scope, and set of possible values. Students do not need to validate the input data.
Export data
The output data has only one line: the incompatibility score (D) is always a positive integer. with the least value from students Every couple that is selected (In the case where there is more than 1 pair with the same incompatibility score, answer with only 1 incompatibility score.)
Example 1
input data
22
45
45
Export data
0
Example 2
input data
53
421
122
133
123
456
Export data
1
Example 3
input data
54
1111
5555
2345
3451
5115
Export data
14

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Big Data Fundamentals Concepts, Drivers & Techniques

Authors: Thomas Erl, Wajid Khattak, Paul Buhler

1st Edition

0134291204, 9780134291208

More Books

Students also viewed these Databases questions