HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Contests > CEN112 Questions 2016 > problem:


15-MdtE-2. 50916 - Ascending Numbers

CEN112 Questions 2016

Start: Mar.30.2016 at 03:10:22 PM
Finish: Apr.01.2016 at 05:00:00 AM
The contest is finished!
• Contest scoreboard

Guest
• Review clarifications (1)

Contest problems

• 15-FE-6. 50989 - Rectangles and Points
• 15-FE-7. 50990 - Two Neighbors
• 15-FE-8. 50991 - Intersecting Circles
• 15-HW-2. 50932 - Shifting rows and...
• 15-HW-3. 50933 - Sum of the Bigges...
• 15-HW-4. 50934 - Selling Cars
• 15-HW-5. 50935 - Max Discount
• 15-MdtE-1. 50915 - Trip to Korca
• 15-MdtE-2. 50916 - Ascending ...
• 15-MdtE-3. 50913 - Manhattan Distance
• 15-MdtE-4. 50917 - Descending Nu...
• 15-MdtE-5. 50912 - Trip to Librazhd
• 15-MdtE-6. 50914 - Buy 3, Pay 2
• 15-PE-1. 50865 - Apartment Building...
• 15-PE-2. 50866 - Buy the cheapest
• 15-PE-4. 50868 - Sort Frequencies
• 15-PE-5. 50869 - Birthday Celebration

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.
Question by Ibrahim Mesecan.

Ascending Numbers

Ascending numbers are

  • at least two digits numbers
  • whose last digit is one of the greatest digits and
  • all its digits are in ascending order (greater than or equal to the previous digit).
For example, 123, 12236 and 11122 are ascending numbers. But the following are not ascending numbers:
  • 1212: because there is 1 after 2.
  • 12223342: because there is 2 after 4
  • 111111: because all digits are the same (last digit is not the greater than any other).

Question: Write a program that takes n numbers. Then, it counts and shows the number of ascending numbers.
Note: If needed, you can use the following functions from #include "utils/functions.h"
 int numDigits(int num); // which returns the number of digits of the given number
 int getDigit(int num, int k); // which returns kth digit of the given number where k=1 is the least significant digit

Input specification
You will be given an integer in the beginning: the number of numbers (n). Then, in the following n lines you will be given n numbers where 0 ≤ n ≤ 40,000 and the numbers are at most 16 digit numbers.

Output specification:
Show the number of ascending numbers.

Sample Input I
10
941
7
7061
7005
1122
543
489
46043
4677
3057
Sample Output I
3

Explanation:
There are 3 ascending numbers in the list: 1122, 489, and 4677.



Для отправки решений необходимо выполнить вход.

www.contester.ru