All Tracks Problem

Vanya and Students yet again !!
Tag(s):

Very-Easy, 非常に簡単

Problem
Editorial
Analytics

Vanya is back with yet another task for you, and this time out, she has tried to make it more interesting for you. So, this is how it goes:

Vanya has some students studying in her class. For each students, she gives you $$3$$ pieces of information, i.e their Name, ID and Age.

Now, considering you have been given this information, Vanya needs to know from you the number of ways she can select $$2$$ distinct students, such that they share the same age. Can you help her out ?

Input Format:

Table : Students

Field Type
Name text
ID text
Age int

Sample:

Name ID Age
Micro 12abcd 2
Vasya 13abcd 2
Rhezo 14abcd 2
Fredo 15abcd 3
Shino 16abcd 3

Output:

answer
4

Constraints :

$$ 1 \le Age \le 10 $$

$$ 1 \le | Name, ID | \le 20 $$

Explanation

The ways Vanya can select $$2$$ students sharing the same age is :

  1. (Vasya,Rhezo)

  2. (Vasya,Micro)

  3. (Rhezo,Micro)

  4. (Fredo,Shino)

So, the answer is $$4$$.

Time Limit: 5 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB
Marking Scheme: Marks are awarded when all the testcases pass.
Allowed Languages: MySQL, PostgreSQL, MSSQL, Oracle Database

CODE EDITOR

Initializing Code Editor...
Your Rating:

Contributor

Notifications
View All Notifications