ГлавнаяСборникиТурнирыРазделыФорумыУчастникиПечатьПомощьО системе

Разделы > Арифметика > задача:


50353 - Cube of the Largest number

Гость
• Вопросы к жюри (3)

Задачи раздела

• 50297 - Divisible By Five
• 50394 - Water Bills
• 50363 - Class GPA Average
• 50398 - Sum of kth Anti-diagonal
• 50651 - Largest power of two
• 50388 - Number of Armstrong Num...
• 50359 - Mode of a Series
• 50440 - Call Center
• 50353 - Cube of the Largest nu...
• 50336 - Buying Carpets
• 50295 - Weighted Average
• 50296 - Total Discount Rate
• 50289 - Monthly Allowance
• 50559 - Faktoret e thjeshte te numrit
• 50568 - Llogaritesi i indeksit te mas...
• 50579 - Numrat pentagonal
• 50584 - Pagesa totale

Обратная связь

Если у вас есть предложения или пожелания по работе Contester, посетите форум сайта www.contester.ru.

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
Question by Ibrahim Mesecan.

Cube of the Largest number

Your professor wants you to find cube of the largest number which smaller than the given number (n). e.g. if he gives 135, cube of the largest number that is smaller than 135 is 53 (125).

But, later, your professor said that he is transmitting the numbers over a secure program. You understand that you can't get the number 135 but you are given the digits one by one and in reverse order 5 3 1.

Question:
Write a program that that gets n-digits in reverse order, then, calculates cube of the largest number which is less than or equal to the given number.

Input specification
You will be given a number (n) first where n is between 1 and 15. Then, you will be given n digits separated by spaces.
Note: The number can have 15 digits, (you cannot use int), but you can use long long.

Output specification
Show one number which is cube of the largest number with the given criteria.

 Sample Input I   
  3
  5 3 1
 Sample Input II   
  6
  5 3 1 5 3 1
 Sample Output I   
  5
 Sample Output II   
  51


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

www.contester.ru