1 задача в консольном режиме С++

Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.
To predict person's fate, numerologist takes time of a person's life in seconds,then adds all it's digits together. If that sum of digits is bigger than single digit, the "additional" operation is repeated until it will be a single digit. Then to figure out person's fate numerologist needs a total number of operations needed to convert a number from origin to sigle digit.
Numerologist is not a scientific man,so he is not so good in math. Write a program that will do all the calculations for him. Input:
One number N - (1 <= N <= 10[sup]1000[/sup])
Output:
Two numbers - first is the single digit number,second total number of operations needed for conversion.
Samples:
[table][tr][th]№[/th][th]Input[/th][th]Output[/th][/tr][tr][td]1[/td][td]1[/td][td]1 0[/td][/tr][tr][td]2[/td][td]10[/td][td]1 1[/td][/tr][tr][td]3[/td][td]99[/td][td]9 2
[/td][/tr][/table]
Numerologist is not a scientific man,so he is not so good in math. Write a program that will do all the calculations for him. Input:
One number N - (1 <= N <= 10[sup]1000[/sup])
Output:
Two numbers - first is the single digit number,second total number of operations needed for conversion.
Samples:
[table][tr][th]№[/th][th]Input[/th][th]Output[/th][/tr][tr][td]1[/td][td]1[/td][td]1 0[/td][/tr][tr][td]2[/td][td]10[/td][td]1 1[/td][/tr][tr][td]3[/td][td]99[/td][td]9 2
[/td][/tr][/table]
больше 2 лет назад
Ближайшие курсы

Интенсив «Основы программирования»
Онлайн-курс
22
апреля

C#. Уровень 3
Продвинутый курс
22
апреля

SMM: маркетинг в соц. сетях
Лидогенерация и работа с аудиторией
22
апреля
Новые статьи

Что делает мобильную версию сайта привлекательной?
32223

Что читать, чтобы открыть IT-стартап
116626

Приглашаем на воркшоп по React Native
1080173
Новые вебинары

Основы языка Kotlin
28 апреля2444

Ключевые составляющие SEO оптимизации. Часть 2
26 апреля580

Создание гостевой книги на PHP с использованием AJAX
25 апреля150
Новые темы

Антон Бутенко
Adobe After Effects
0
ответов