Dragon Race

Правка en22, от niveditavb05, 2023-01-31 13:42:24

Dragon Race Problem | Codehive Contest | 4th Problem

PROBLEM LINK : CodeHive/Dragon Race

Author & Tester : Vedant Patil

Editorialist : Nivedita Birajdar

DIFFICULTY :

CAKEWALK...

PROBLEM :

Jake is a very competitive guy. The flying speed of Toruk i.e.Dragon of Jake is exactly 100 kmph i.e. kilometers per hour. Dragon Race is going in Pandora Village.

You are given an array A[] of size N, where A[i] denotes the Flying speed of the iᵗʰ Dragon.

Jake is going to compete with everyone. At the end of the competition, the final score of Jake will be evaluated

The evaluation Scheme is given as follows:

If the participant wins the race with his competitor he gets 5 points if he loses 2 points are deducted and if no one wins i.e. match draw then both the participants will get 2 points.

You have to find the final Score of Jake. As Jake is quite dumb in Maths help him to find his final score.

Input Format :

  • The first line contains an integer N, the size of the array.
  • The Second line contains the N space-separated integers, the flying speed of the dragons.

Constraints :

  • 1 ≤ N ≤ 100

  • 1 ≤ Ai ≤ 212

Output Format :

Output the final score of Jake.

Sample Input :

3
98 100 119

Sample Output :

5

Explanation :

Jake will win the race with the first dragon with a flying speed of 98, score = 5

The match will be drawn with the second dragon with a flying speed of 100, score = (5) + (2) = 7

Jake will lose the race with the third dragon with a flying speed of 119, score = (5) + (2) + (-2) = 5

so final score of Jake will be, score = (5) + (2) + (-2) = 5

Solution :

Editorialist's solution(C++)

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en35 Английский niveditavb05 2023-01-31 19:44:54 7 Tiny change: 'EXITY:**\n **O(n)**\n' -> 'EXITY:**\n**O(n)**\n' (published)
en34 Английский niveditavb05 2023-01-31 19:44:13 7 Tiny change: 'EXITY:**\n**O(n)**\n' -> 'EXITY:**\n **O(n)**\n' (saved to drafts)
en33 Английский niveditavb05 2023-01-31 19:43:11 39 Tiny change: 'n\n#### **' -> 'n\n#### **TIME COMPLEXITY:**\n**O(n)**\n\n#### **'
en32 Английский niveditavb05 2023-01-31 19:38:17 1 Tiny change: ' given an rray A[] o' -> ' given an array A[] o'
en31 Английский niveditavb05 2023-01-31 19:28:03 41
en30 Английский niveditavb05 2023-01-31 19:22:39 27 (published)
en29 Английский niveditavb05 2023-01-31 19:21:11 12
en28 Английский niveditavb05 2023-01-31 19:19:50 116
en27 Английский niveditavb05 2023-01-31 19:16:00 28
en26 Английский niveditavb05 2023-01-31 19:15:14 46
en25 Английский niveditavb05 2023-01-31 19:11:45 957
en24 Английский niveditavb05 2023-01-31 17:24:57 852
en23 Английский niveditavb05 2023-01-31 17:08:16 0 (saved to drafts)
en22 Английский niveditavb05 2023-01-31 13:42:24 0 (published)
en21 Английский niveditavb05 2023-01-31 13:38:39 59
en20 Английский niveditavb05 2023-01-31 13:29:26 8 Tiny change: 'Y :** \n EASY...\n\n\n#' -> 'Y :** \n CAKEWALK...\n\n\n#'
en19 Английский niveditavb05 2023-01-31 13:26:20 32 Tiny change: ' summary="mycode">\n```\n#' -> ' summary="Editorialist's solution(C++)">\n```\n#'
en18 Английский niveditavb05 2023-01-31 13:25:08 20
en17 Английский niveditavb05 2023-01-31 13:24:02 12
en16 Английский niveditavb05 2023-01-31 13:22:53 39
en15 Английский niveditavb05 2023-01-31 13:17:26 4 Tiny change: 'tion :**\n#include' -> 'tion :**\n\n\n#include'
en14 Английский niveditavb05 2023-01-31 08:37:44 589
en13 Английский niveditavb05 2023-01-31 08:26:14 2
en12 Английский niveditavb05 2023-01-31 08:25:31 23
en11 Английский niveditavb05 2023-01-31 08:24:05 51
en10 Английский niveditavb05 2023-01-31 08:21:55 6
en9 Английский niveditavb05 2023-01-31 08:21:00 4 Tiny change: 'em**\n\n\n**#### PROBLEM LI' -> 'em**\n\n\n#### **PROBLEM LI'
en8 Английский niveditavb05 2023-01-31 08:20:36 5 Tiny change: '**\n\n\n**PROBLEM LI' -> '**\n\n\n**#### PROBLEM LI'
en7 Английский niveditavb05 2023-01-31 08:20:15 4 Tiny change: '**### Dragon Rac' -> '### **Dragon Rac'
en6 Английский niveditavb05 2023-01-31 08:19:56 23
en5 Английский niveditavb05 2023-01-31 08:19:20 4
en4 Английский niveditavb05 2023-01-31 08:18:12 54
en3 Английский niveditavb05 2023-01-31 08:16:39 25
en2 Английский niveditavb05 2023-01-31 07:51:04 824
en1 Английский niveditavb05 2023-01-31 07:44:34 2561 Initial revision (saved to drafts)