CT1556

Rhys's tickets Dominant Values

EasyL2 · Byte BanditAcceptance: 0.0%XP: 10

At the shale slopes of Greystone, Rhys records each tickets in a worn leather ledger. The guild wants answers, not guesses. Task: Read n integers and print how many of the elements after the first are strictly greater than the first element. Input format: First line: n. Second line: n space-separated integers. Output format: Print the count of elements a[2..n] greater than a[1]. Constraints: 1 <= n <= 64; -1000000 <= a[i] <= 10; answers fit a signed 64-bit integer.

Example 1:

Input: 42 -539281 -95989 -137240 -611565 -262824 -959494 -672195 -537715 -854016 -397338 -460604 -99259 -532994 -836910 -584114 -92855 -480165 -133046 -68339 -640536 -999941 -882231 -423539 -974287 -518955 -600222 -582711 -859240 -347376 -694437 -196925 -990849 -281744 -95831 -195691 -870467 -529864 -230582 -716556 -867834 -285219 -943713
Output: 22

Example 2:

Input: 36 -395802 -279662 -409867 -106236 -551042 -389513 -306498 -183630 -196066 -20527 -325665 -212329 -809902 -245602 -853969 -499213 -312788 -142434 -611997 -110021 -285811 -12588 -312288 -980224 -394632 -680533 -735000 -929052 -155932 -99235 -288010 -607134 -303329 -484179 -336645 -871251
Output: 22

Example 3:

Input: 7 -929081 -730345 -560408 -362391 -266952 -428319 -120644
Output: 6

Constraints:

1 <= n <= 64; -1000000 <= a[i] <= 10; answers fit a signed 64-bit integer.

Loading...
Test Cases:No test cases
No test cases available.
Rhys's tickets Dominant Values - EASY Coding Problem | CodeTikki